Skip to content

alpha037/atlas-task-manager

Repository files navigation

atlas-task-manager

A RESTful API for creating, reading and managing tasks and their respective users. Hosted on MongoDB Atlas, this REST api provides fast access to anything you need. Documentation provided below.

Deployment

Deployed at http://task-manager.shubhranil.com

Table of Contents

Built With

Getting Started

Make sure you have nodejs installed. We use npm to manage the dependencies, so we strongly recommend you to use it. After that, navigate into the project directory and run npm install to resolve all dependencies.

Features Include

  • Tasks CRUD
  • Users CRUD
  • Task sorting
  • Task limiting for pagination
  • User profiles
  • Image uploads
  • JWT authentication
  • Password hashing using slow hashing techniques for advanced security purposes.
  • Login from multiple devices
  • Auto resize and cropping of user avatars
  • Sending out welcome emails to every signed up user
  • Sending out cancellation follow up emails to every user who wants to delete their account

Docker Instructions

If you haven't installed Docker already, then you can get it from here. After installing it, create an account in Docker and copy the username.

This API part of the application is already dockerized. You can pull it directly from docker hub:

docker pull alpha037/atlas-task-manager_api:latest

Since this application needs to talk to a database, so, you can either create your own mongodb database (cloud/native) or you can use the docker-compose.yml file to spin up a mongodb instance along with the entire application.

  • For Development:
    • Using Docker: If you want to use Docker for your development environment, then you can just execute the following command and it will spin up two docker containers (one for the api and the other for the db) along with a persisted volumes directory. This will use the dev.docker.env file. See the example file.
      docker-compose up --build
    • Without Using Docker: However, if you don't want to use docker, then you can just execute the following command, provided that you have a mongodb instance running locally. This will use the dev.env file. See the example file.
      npm run start:dev
  • For Production: For your production environment, the API talks to the mongodb atlas db instance. In that case, you can run the following command. This will use the prod.env file. See the example file.
    npm run start:prod

API Endpoints

Note: All the API endpoints are prefixed by /v1/ for better versioning. Ex: BASE_URL/v1/users.

POST Endpoints:

Endpoint Verb Description
/users POST Signing up users
/tasks POST Creating tasks for users
/users/login POST Logging in users
/users/logout POST Logging out users
/users/logoutAll POST Logging out all user sessions from multiple devices
/users/me/avatar POST Uploading user avatar

GET Endpoints:

Endpoint Verb Description Query Params
/users/me GET Getting user profile
/tasks GET Getting user tasks
  • sortBy (key)
    • createdAt (value): sorted by created time ASC
    • createdAt_desc (value): sorted by created time DESC
  • completed (key)
    • true (value): only which are completed
    • false (value): only which are NOT completed
  • limit (key)
    • num (value): limited to num tasks
  • skip (key, but must be used with limit)
    • num (value): limiting and skipping for pagination
/tasks/:id GET Getting a specific user task (need to provide a task id)
/users/:id/avatar GET Getting user avatar (need to provide a user id)

PATCH Endpoints:

Endpoint Verb Description
/users/me PATCH Updating user profile
/tasks/:id PATCH Updating user task (need to provide a task id)

DELETE Endpoints:

Endpoint Verb Description
/users/me DELETE Deleting user profile
/users/me/avatar DELETE Deleting user avatar
/tasks/:id DELETE Deleting user task (need to provide a task id)

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated. For more details, check out the contributing guidelines.

  1. Fork the Project.
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature).
  3. Commit your Changes (git commit -m 'Add some AmazingFeature').
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request.

License

Distributed under GNU AGPL 3.0. See LICENSE for more information.

Contact

Shubhranil Dutta - contact@shubhranil.com

Project Link: https://github.com/alpha037/atlas-task-manager