Flask-based application for ecommerce backend. It provides various endpoints for managing users, products, and authentication.
- Home:
GET /
- Retrieves the home page of the application. - Authentication:
- Auth:
POST /auth
- Authenticates users and generates access tokens. - Register:
POST /register
- Registers new users.
- Auth:
- Products:
- Get All Products:
GET /products
- Retrieves all products. - Get Specific Product:
GET /products/<product_id>
- Retrieves a specific product. - Add Product:
POST /products
- Adds a new product. - Update Product:
PUT /products/<product_id>
- Updates an existing product. - Delete Product:
DELETE /products/<product_id>
- Deletes a product.
- Get All Products:
- Users:
- Get All Users:
GET /users
- Retrieves all users. - Get Specific User:
GET /users/<username>
- Retrieves a specific user. - Delete User:
DELETE /users/<username>
- Deletes a user.
- Get All Users:
- Setup:
- Clone the repository.
- Install Docker and Docker Compose if not already installed.
- Running the Application:
- Execute
docker-compose up
command in the project directory. - The following containers will spin up-
- flask_app: Flask application container serving the backend API.
- mongo_db: MongoDB container serving as the primary database.
- redis: Redis container used for caching.
- The application will be available at
http://localhost:4000
.
- Execute
- Testing Endpoints:
- Import the provided Postman collection.
- Set up environment variables for
TOKEN_ADMIN
andTOKEN_USER
with valid JWT tokens. - Run the requests to interact with the API endpoints.
- The application can be tested by importing the provided Postman collection (Postman Endpoints.json)
- The application is built using Python with Flask framework for the backend.
- MongoDB is used as the primary database for storing user and product information.
- Redis is used for caching to improve application performance.
- JWT (JSON Web Tokens) are utilized for user authentication and authorization.
- Endpoints are organized using Flask Blueprints for modularity and scalability.
- Docker Compose is used for containerization and managing application dependencies.
- Nginx has been setup to allow load balancing and weighted load balancing between multiple instances of flask_app hosted
- Can enhance error handling and logging for improved debugging.
- Can setup instrumentation for monitoring application performance and errors
- Need unit-tests and integration tests
- Database high availability features need to be added