DocMan is a Document Management System built using JavaScript. DocMan is a RESTful API for creating and managing documents based on user roles. DocMan gives you the flexibility of choosing what documents you want to be private and available to you only or accessible by other members in the same user role you belong to.
The API has routes, each dedicated to a single task that uses HTTP response codes to indicate API status and errors. View full API documentation here
The following features make up the DocMan's API:
- It uses JSON Web Token (JWT) for authentication
- It generates a token on successful login and returns it to the user
- It verifies the token to ensure a user is authenticated to access protected endpoints
- It allows users to be created
- It allows users to login and obtain a unique token which is valid for 24hours
- It allows authenticated users to retrieve and update their information
- It allows users to retrieve documents based on userId
- It allows the admin to manage users
- It allows creation of new documents by authenticated users
- It ensures all documents are accessible based on access priviledges
- It allows admin users to create, retrieve, and delete documents
- It ensures users can retrieve, edit and delete documents that they own
- It allows users to retrieve all public documents
- It allows users on the same role to retrieve role-based documents
- It allows admin to retrieve all documents that matches search string
- It allows admin to search users based on a specified search term
- It allows users to search documents for a specified search term
- It allows users to search for users using name or email address
- JavaScript ES6 - Codes were written in javascript ES6.
- NodeJS - Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
- ExpressJS - Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. I used this framework for routing.
- PostgreSQL - Postgres is an object-relational database management system (ORDBMS) with an emphasis on extensibility and standards compliance.
- Sequelize - Sequelize is a promise-based ORM for Node.js which supports the dialects of PostgreSQL and features solid transaction support, relations, read replication and more.
- Ensure you have
node
installed or install Node - Clone the project repository from your terminal
git clone https://github.com/joel-ace/docman.git
- Change directory
cd docman
into docman directory - Run
npm install
to install the dependencies in thepackage.json
file - Set your environment variables as described in the
.env.sample
file in DocMan root directory - Run
npm start
to start the project - Run
npm test
to run integration tests - Use Postman or any tool of your choice to access the endpoints
N/B: For all endpoints that require authentication, use
Authorization: <token>
The limitations of DocMan are as follows:
- Users can only create plain textual documents and retrieve same when needed
- Users cannot share documents but can make document
public
for other users to view, or set document access type torole
so only users in the same role can view their documents - Users login and obtain a token which is verified on every request, but users cannot logout (nullify the token), however tokens become invalid when it expires (24 hours)
- There is no endpoint to create, update or delete user roles
Contributors are welcome to further enhance the features of this API by contributing to its development. The following guidelines should guide you in contributing to this project:
- Fork the repository.
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request describing the feature(s) you have added
N/B: Ensure your code extends the AirBnB Javascript Styles Guide