This project implements an Access Control System using Python, Flask, React, JWT (JSON Web Tokens) for authentication and authorization, Swagger for API documentation (/api/docs/), and Docker Compose for containerization. It includes separate back-end and front-end components, as well as unit tests.
- User registration and authentication
- Role-based access control (RBAC)
- Token-based authentication using JWT (refresh and access tokens)
- API endpoints for managing users, roles, and permissions
- Swagger UI for interactive API documentation
- Python: Programming language used for the back-end development.
- Flask: Web framework for building the RESTful API.
- React: JavaScript library for building the user interface.
- JWT: JSON Web Tokens for secure authentication and authorization.
- Docker Compose: Tool for defining and running multi-container Docker applications.
- Swagger: API documentation tool with Swagger UI for interactive documentation.
- Unit Testing: Automated tests for ensuring the correctness of the code.
- Docker and Docker Compose should be installed on your machine.
- Clone the repository:
git clone <repository-url>
- Navigate to the project directory:
cd access-control-system
-
Set up the environment variables:
- Create a
.env
file in the root directory based on the provided.env.example
file. - Modify the values in the
.env
file according to your requirements.
- Create a
-
Set up the back-end:
- Navigate to the
backend
directory:
cd backend
- Install the required dependencies:
pip install -r requirements.txt
- Navigate to the
-
Set up the front-end:
- Navigate to the
frontend
directory:
cd ../frontend
- Install the required dependencies:
npm install
- Navigate to the
- Start the application using Docker Compose:
docker-compose up
-
The back-end server will be running on
http://localhost:5000
, and the front-end will be running onhttp://localhost:3000
. -
Access the Swagger UI for API documentation:
- Open
http://localhost:5000/api/docs/
in your web browser.
- Open
- To run the unit tests for the back-end, navigate to the
backend
directory:
cd backend
- Run the tests using the following command:
python -m unittest discover tests
Contributions are welcome! If you find any issues or have suggestions for improvement, please create a GitHub issue or submit a pull request.
This project is licensed under the MIT License.