correct-me
is a prototype backend API designed for collaborating improvement of message phrasing. It allows users to upload message formulations, suggest alternatives, and choose the best version. Each message is also checked for spelling errors using a service like Yandex Speller, with errors displayed for review.
API Use Cases:
- Sign up and authenticate: Secure access to the service.
- Submit a new phrase: Users can submit phrases for review.
- View and filter phrases: Users can view unresolved phrases or those they authored.
- Submit a new alternative: Users can suggest alternative versions for others' phrases.
- View and filter alternatives: Users can view alternatives and filter them by phrase, author or date of submission.
- Mark best alternative: Authors can select the best alternative phrase to resolve a submission.
- Automatic spell-check: Each phrase and alternative are automatically checked for spelling errors, with a list of errors provided.
Technologies Used:
- Haskell
- Servant
- Postgres (hasql)
- wreq / http-conduit
- Swagger UI
The API is protected by BasicAuth or JWT. To access them, you need to register by issuing a POST request to /api/users
. See API Documentation or see the section below for details.
You can run the application either with stack
or using docker-compose
. The API can be accessed at localhost:8080
or at whatever host/port is specified in config.toml
.
- Ensure you have Stack installed and a Postgres database running.
- Clone the repository:
git clone https://github.com/almayor/correct-me.git cd correct-me
- Add the credentials needed to access the Postgres database to the
config.toml
file. - Build and run the application:
stack build stack run
- Ensure you have Docker and Docker Compose installed.
- Clone the repository:
git clone https://github.com/almayor/correct-me.git cd correct-me
- Build and run the Docker containers:
docker-compose up
I am using hspec for testing. You can run the tests as follows:
docker-compose run --entrypoint stack app test
Github Actions have been set up to continuously
- test the project
- re-build the Docker image and push it to Docker Hub
- update the API Documentation
- Servant Docs: The API documentation generated by Servant can be accessed at
/docs
. The Markdown file can also be accessed here. - Swagger UI: The Swagger UI for the API can be accessed at
/swagger-ui
.
- Build a front-end client for the API
- Add more tests
- List alternative responses and exceptions in Swagger and Servant.Docs
- Use pagination with servant-pagination
- Use Redis to cache requests
- Implement rate limiting to prevent abuse
- Add monitoring and alerting for the application
- Slim down Docker image by leveraging two-stage builds