Skip to content

tusharad/Reddit-Clone-Haskell

Repository files navigation

HaskRead - Reddit clone written in Haskell

HaskRead is a Reddit clone web application build for learning building real world production application in Haskell.

Setting up local development environment

The instructions for setting up setting local dev environment is provided in respective frontend and backend projects.

alt text

Tech Stack

Backend - Haskell (Servant)

Frontend - Haskell (Hyperbole)

ER Diagram

alt text

Key Web application functionalities that has been implemented so far:

User Authentication and Authorization

  • Login, Register with email OTP, and password reset here
  • Implemented Google OAuth2 here
  • Access control to specific routes using AuthResult

Data management

  • Database operations: Performed CRUD operations using Servant.
  • Data Validation: Ensure data integrity by applying sanity checks before storing data.
  • File Storage: Uploading documents (Image, docx, pdf) in local storage (In future, It can be uploaded to storage buckets.)

API Development

  • Restful API: Create endpoints for frontend or third-party applications to interact with the backend (./haskread-platform-be/src/Platform/API.hs).
  • Implemented serveral core logics for the application and divided it in several different modules.

Error Handling and Logging

  • Gracefully handling errors and returning meaningful responses for e.g throw400Err
  • Logging: Added Debug, Info, Warn, Error level logging mechanism using FastLogger here

Security

  • Input sanitization: Used Orville postgres ORM to avoid SQL injection and type safety.
  • Encryption: User passwords are encrypted using Password.
  • Rate limiting: Rate limiting is yet to be implemented.

Performance Optimization

  • Caching - caching is partially implemented using Haxl but being used.
  • Database Indexing - Necessary fields are indexed.

Background Jobs and Task Queues

  • Task queues/ Async processing - So far, there is no functionality in application that requires async or task queues.

Third party integration:

  • Email services: Integrated MailGun API for sending verification emails.

Database Migrations and Seeding

  • Migration and seeding: Migration and seeding has been implemented for initiating and popluating postgres data for testing with Orville.

Testing

  • Unit tests with help of tasty-hunit and API testing with the help of tasty-wai has been implemented. here
  • Written a bash script to perform testing on UI by fetching html pages using curl and checking if specific elements exist or not.

CI

  • Github actions is being used to build be and ui, run test cases and deploy to GCP.

Scalability

  • Nothing scalability related stuff has been implemented.

Compliance and Legal

  • Nothing Compliance related measures has been taken since it is an application made for learning Haskell and not for real production app.

Analytics and Reporting

  • Nothing related to Analytics has been implemented yet.

Notifications

  • Push Notifications are yet to be implemented

Search Functionality

  • Simple search functionality has been implemented with help of Vector Text search. here

Versioning

  • API Versioning is done (all apis are prefixed with v1)

Documentation

  • Some Documentation exists in ./haskread-platform-be/Wiki but are unmaintained.