ASEProb Backend is a Flask-based RESTful API for managing clients, products, and orders. It uses MongoDB as its database and provides JWT authentication for secure access to the API endpoints.
- RESTful API endpoints for clients, products, and orders
- MongoDB integration for data persistence
- JWT authentication for secure API access
- Dockerized application for easy deployment and scaling
- Environment-based configuration for flexibility across different deployment environments
- Python 3.9+
- Docker
- MongoDB (for local development without Docker)
-
Clone the repository:
git clone https://github.com/yourusername/aseprob-backend.git cd aseprob-backend -
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Create a
.envfile in the project root and add your environment variables:SECRET_KEY=your_secret_key MONGO_URI=mongodb://your_mongodb_uri DEBUG=True PORT=5000 JWT_SECRET_KEY=your_jwt_secret_key JWT_ACCESS_TOKEN_EXPIRES=3600
-
Ensure MongoDB is running locally or update the
MONGO_URIin your.envfile. -
Run the Flask application:
python main.py
-
The API will be available at
http://localhost:5000.
-
Build the Docker image:
./build.sh
-
Run the Docker container:
./run.sh
-
To build and run in one step:
./build_and_run.sh
The API will be available at http://localhost:5000.
/clients- GET (list all clients), POST (create a new client)/clients/<client_id>- GET, PUT, DELETE operations for a specific client/products- GET (list all products), POST (create a new product)/products/<product_id>- GET, PUT, DELETE operations for a specific product/orders- GET (list all orders), POST (create a new order)/orders/<order_id>- GET, PUT, DELETE operations for a specific order
All endpoints require JWT authentication.
To access the API endpoints, you need to include a JWT token in the Authorization header of your requests:
Authorization: Bearer <your_jwt_token>
- The
app/directory contains the core application code. - Models are defined in
app/models/. - Route handlers are in
app/routes/. - Authentication logic is in
app/services/auth.py. - Database connection is managed in
app/database.py.
(Add information about running tests when you implement them)
This application is containerized and can be easily deployed to any Docker-compatible hosting service. Make sure to set the appropriate environment variables in your production environment.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE.md file for details.