Application developed by Andres Betancourt
For a better development experience, we recommend the following tools:
Before starting the project, make sure you have the following installed:
- Node.js (v14.x or later)
- PostgreSQL (for the database)
- AWS S3 account (for file storage)
To install the required project dependencies, run the following command:
npm install
This will install all necessary dependencies, including the backend and any other required libraries.
Make sure to create a .env
file in the root of your project and add the following environment variables:
# Database Configuration
DB_HOST=your-database-host
DB_PORT=your-database-port
DB_USER=your-database-username
DB_PASSWORD=your-database-password
DB_NAME=your-database-name
# AWS Configuration
AWS_ACCESS_KEY_ID=your-aws-access-key
AWS_SECRET_ACCESS_KEY=your-aws-secret-key
AWS_REGION=your-aws-region
AWS_BUCKET_NAME=your-s3-bucket-name
# JWT Secret
JWT_SECRET=your-secret-key
# Other optional configuration (adjust as needed)
PORT=5000
To start the application in development mode, use the following command:
npm run dev
This will start the Express server and make the API accessible locally (usually at http://localhost:5000
).
To build and deploy the project for production, use the following commands based on your operating system:
# Windows
npm run build:win
# macOS
npm run build:mac
# Linux
npm run build:linux
This will bundle your application for the specific operating system, optimizing it for production.
If you're working on the front-end (web) part of the project, follow these steps:
# For Windows
cd web
To run the development server for the front-end (if you have a separate web directory):
# For Windows
npm run dev
This will start the front-end application in development mode and make it accessible in your browser.
The backend provides a REST API with the following main routes:
GET /api/users
: Get all usersGET /api/users/:id
: Get a user by IDPOST /api/users
: Create a new userPUT /api/users/:id
: Update user informationDELETE /api/users/:id
: Delete a user
GET /api/products
: Get all productsGET /api/products/:id
: Get a product by IDPOST /api/products
: Create a new productPUT /api/products/:id
: Update a productDELETE /api/products/:id
: Delete a product
GET /api/orders
: Get all ordersGET /api/orders/:id
: Get an order by IDPOST /api/orders
: Create a new orderPUT /api/orders/:id
: Update order detailsDELETE /api/orders/:id
: Delete an order
GET /api/shipping
: Get all shipping detailsGET /api/shipping/:id
: Get shipping details by IDPOST /api/shipping
: Create a new shipping entryPUT /api/shipping/:id
: Update shipping detailsDELETE /api/shipping/:id
: Delete shipping details
POST /api/login
: Login endpoint to authenticate usersPOST /api/register
: Register a new user
- Backend: Node.js, Express.js
- Database: PostgreSQL
- Cloud Storage: AWS S3 for storing product images
- Authentication: JWT (JSON Web Tokens) for securing API endpoints
- File Upload: Multer for handling file uploads (e.g., product images)
- CORS: To allow cross-origin requests
- Logging: Morgan for logging HTTP requests
- ESLint: Linter to ensure consistent coding style
- Prettier: Code formatter for consistent formatting
- Jest: Testing framework for writing and running tests (optional, but recommended)
You can test the application by using tools like Postman or Insomnia to send HTTP requests to the API endpoints. You can also write unit and integration tests using Jest or Mocha if desired.
If you'd like to contribute to this project, follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature-name
) - Commit your changes (
git commit -m 'Add new feature'
) - Push to your forked repository (
git push origin feature-name
) - Open a Pull Request with a description of your changes
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or feedback, please contact Andres Betancourt at [info@cre8tive.pro].