Backend of the EcoPart application
This repository contains the backend codebase for the EcoPart application, built using TypeScript, NodeJS, Express, SQLite, and Jest for testing. The architecture follows a clean structure, and the API is designed based on REST principles.
To install the necessary dependencies, run the following command:
npm install
To run the backend in development mode with automatic restarts on code changes, use the following command:
npm run dev:watch
To execute tests and generate a coverage report, use the following command:
npm run test
To publish a new version, create and push a new tag for the application's code. Pushing a tag in the GitHub repository triggers a GitHub Action that builds the Docker image and publishes it on Docker Hub. The Docker image can be found here.
To deploy a new version of the application to production, follow these steps:
-
Prepare the Environment:
- Copy the
empty.env
file to your server and rename it to.env
. Set your environment variables as needed.
- Copy the
-
Run the Application:
-
Copy the
docker-compose.yml
file to your server. -
Run the following command to start the application using Docker Compose:
docker compose up
-
Clean Architecture is a software design principle that emphasizes separation of concerns and modularity, aiming to create a flexible and maintainable codebase. It divides the application into layers, such as presentation, domain, and data, ensuring that dependencies flow inward, maintaining a clear boundary between the layers. This approach allows developers to change the implementation details of one layer without affecting the others, promoting code reusability and testability.
REST API (Representational State Transfer API) is a set of guidelines and principles for designing web services that communicate over HTTP. It follows a stateless client-server architecture where each resource is uniquely identified by a URL, and standard HTTP methods (GET, POST, PUT, DELETE) are used to perform CRUD (Create, Read, Update, Delete) operations on these resources. REST APIs are designed to be scalable, simple, and easily integrated with various platforms, making them a popular choice for building web services.