Memoire is an online journal where users can pen down their thoughts and feelings. The Memoire WebAPI is powered by NestJS.
-
- Node.js®, a JavaScript runtime built on Chrome's V8 JavaScript engine.
- NestJS, a progressive Node.js framework for building efficient and scalable server-side applications.
- JSON Web Token (JWT) for token-based authenication.
- PostgreSQL, an open source object-relational database system.
- TypeORM, an ORM that can run in NodeJS, Browser, Cordova, PhoneGap and Ionic platforms and can be used with TypeScript and JavaScript.
- Amazon S3, a scalable, high-speed, low cost, web-based service designed for backup and archiving of data.
-
- Pivotal Tracker, agile project management tool of choice for developers, was used in managing this project.
- Docker & Docker-Compose, a container technology, was applied to serve up the server application and database in separate but connected containers.
-
- Postman, a complete API development environment, and flexibly integrates with the software development cycle for API testing.
-
- Install Node.js® and PostgreSQL on your host environment (or PC).
- Create a Postgres database with the name:
memoiredbor any appropriate name. Note the host, port, username and password of the database. - Ensure Git is installed, then clone this repository by running
git clone https://github.com/krizten/Memoire-API.gitin the terminal. - Install the project dependencies by running
npm install - Create a .ENV file, using the .env.example as a sample fill all the fields with correct data.
- Ensure the database service is running, then start the server application in development mode by running
npm run start:dev - Use the API documentation to see available endpoints.
-
- Install Docker and Docker-Compose on your host environment (or PC).
- Clone this repository by running
git clone https://github.com/krizten/Memoire-API.gitin the terminal. - Open the docker-compose.yml, then note the database name, host, port, username and password.
- Create a .ENV file, using the .env.example as a sample fill all the fields with correct data.
- Start the application in development mode by running
docker-compose up
Some of the available endpoints are listed below.
POST /api/v1/auth/signup :-->Sign up a new userPOST /api/v1/auth/login :-->Log in an existing userGET /api/v1/entries :-->Get all diary entries made by the userPOST /api/v1/entries :-->Create a new diary entryPUT /api/v1/entries/{id} :-->Update an existing diary entryDELETE /api/v1/entries/{id} :-->Delete a diary entryGET /api/v1/account :-->Retrieve user's account detailsPOST /api/v1/uploads/avatar :-->Upload a new avatar for the user
See complete documentation here.
-
- Install Postman or any preferred REST API Client such as Insomnia, Rest Client, etc.
- Get the application up and running by following the instructions in the Installation Guide of this README.
- Use the API documentation as a guide to access available endpoints.
For demonstration purposes, the Memoire WebAPI was deployed to Heroku using the free cloud hosting plan bundled with free dyno hours and several options for data storage.
- Create an account with Heroku or log in if you already have an account.
- Download and install the Heroku CLI matching your operating system.
- Clone this repository using
git clone https://github.com/krizten/Memoire-API.git - In your project root directory, run the command
heroku loginand supply the right credentials. - With a working Docker installation, log in to Container Registry using
heroku container:login - Create a Heroku app by running
heroku create <app-name>. - Visit Heroku Addons to add PostgreSQL addon to the app. The connection string added to the app is usually of the format
postgres://YourUserName:YourPassword@YourHost:5432/YourDatabase. - Navigate to the settings area of the newly created app and use the
Config Varsto add necessary environment variables (see .env.example). - Build the image from the Dockerfile and push to Container Registry using
heroku container:push web. - Release the image to the app using
heroku container:release web. - To access the deployed app, run
heroku openwhich opens the app in your default browser.
-
- Integrate CI/CD for a better workflow management.
- Automated testing for faster bug discovery and debugging.
- Integrate WebSockets on server and clients to reduce HTTP requests and improve on server availability.
- Implement database caching using Redis for faster data serving.
- Layering GraphQL on existing REST API to enjoy the benefits of GraphQL.
- Replace Winston FileLogger with a dedicated logging service such as Sentry to improve performance.
- Perform scaling in production environment by taking advantage of Nginx, PM2 or easy-to-use AWS Elastic Beanstalk.
-
- Verify user's account/email to prevent bots from registering.
- Tracking usage history (last seen and time spent on the app).
