Document Management System provides a restful API for users to create and manage documents giving different privileges based on user roles and managing authentication using JWT.
The API has routes, each dedicated to a single task that uses HTTP response codes to indicate API status and errors.
The following features make up the Document Management System API:
- It uses JSON Web Token (JWT) for authentication
- It generates a token on successful login or account creation and returns it to the user
- It verifies the token to ensure a user is authenticated to access every endpoints
- It allows users to be created
- It allows users to login and obtain a unique token which expires every 12hours
- It allows authenticated users to retrieve and update their information
- It allows users to retrieve their documents based on userId
- It allows the admin to manage users
- It ensures roles can be created, retrieved, updated and deleted by an admin user
- A non-admin cannot access this endpoint
- A non-admin user cannot create, retrieve, modify, or delete roles
- It allows assignment of roles to users
- It allows new documents to be created by authenticated users
- It ensures all documents are accessible based on the permission/priviledges
- It allows admin users to create, retrieve, modify, and delete documents
- It ensures users can retrieve, edit and delete documents that they own
- It allows users to retrieve all documents they own as well as public documents
- 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 term
- It allows admin to search users based on a specified search term
- It allows users to search public documents for a specified search term
- It allows users to search for users through name or email address
- It allows users on the same role to search through role-based documents
- View API endpoints and their functions here
- JavaScript ES6 - Codes were written in javascript to enhance HTML pages.
- ReactJS - React is an open-source JavaScript library for building user interfaces.
- 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/andela-moseni/document-mgt-system.git
- Change directory into the
document-mgt-system
directory - Run
npm install
to install the dependencies in thepackage.json
file - Run
npm run start:nodemon
to start the project - Run
npm test
to run the server-side(api) tests - Run
npm run test-e2e
to run the e2e tests - Run
npm run client:test
to run the client-side(React) tests - Use Postman or any API testing tool of your choice to access the endpoints
N/B: For all endpoints that require authentication, use
'x-access-token': <token>
or authorization: <token>
The limitations to the Document Management System API are as follows:
- Users can only create plain textual documents and retrieve same when needed
- Users cannot share documents with people, but can make document
public
to make it available to other users - 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 (after 12 hours)
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 -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request describing the feature(s) you have added
- Include a
feature.md
readme file with a detailed description of the feature(s) you have added, along with clear instructions of how to use the features(s) you have added. This readme file will be reviewed and included in the original readme if feature is approved.
Ensure your codes follow the AirBnB Javascript Styles Guide