Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rifatkasikci/mercury-backend
Mercury is an open-source platform designed to empower freelancers by facilitating skill exchanges through a barter system.
https://github.com/rifatkasikci/mercury-backend
digitalocean express express-validator generic-repository javascript jwt-authentication migrations nginx nodejs postgresql rbac redis seed sequelize
Last synced: 3 months ago
JSON representation
Mercury is an open-source platform designed to empower freelancers by facilitating skill exchanges through a barter system.
- Host: GitHub
- URL: https://github.com/rifatkasikci/mercury-backend
- Owner: rifatKasikci
- Created: 2024-09-17T06:27:47.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-17T07:03:57.000Z (4 months ago)
- Last Synced: 2024-09-26T04:20:09.095Z (4 months ago)
- Topics: digitalocean, express, express-validator, generic-repository, javascript, jwt-authentication, migrations, nginx, nodejs, postgresql, rbac, redis, seed, sequelize
- Language: JavaScript
- Homepage:
- Size: 87.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mercury - Freelancers Barter System
Mercury is a platform designed to allow freelancers to barter their services, providing a way to exchange skills without monetary transactions. This project was initially conceived two years ago as a startup idea and is now open-sourced to be part of my portfolio.
## Project Overview
Mercury enables freelancers to:
- Offer services
- Search for others' services
- Exchange skills in a barter systemAlthough this project is not live at the moment, the backend system is fully functional and serves as a robust foundation for future development.
## Features
- **Generic Repository Pattern**: Simplifies data access logic and makes the code more maintainable.
- **Redis Caching**: Enhances performance by caching frequent data.
- **Migrations with Sequelize**: Allows seamless updates to the database schema.
- **Role-based JWT Authentication**: Secures the platform with roles and token-based access control.
- **reCAPTCHA Integration**: Protects against bots and spam.
- **Rate Limiting**: Ensures API stability by limiting the number of requests.
- **Email Sending**: Sends notifications and confirmations via email.
- **Validation**: Ensures data integrity and security.## Tech Stack
- **Backend**: Node.js, Express.js
- **Database**: PostgreSQL (via Sequelize ORM)
- **Caching**: Redis
- **Authentication**: JWT (Role-based)
- **Deployment**: DigitalOcean Droplets, NGINX, Linux## Setup Instructions
### Prerequisites
- Node.js (v16+)
- PostgreSQL
- Redis
- A DigitalOcean droplet or other hosting platform (optional for deployment)1. Clone the repository:
```bash
git clone https://github.com/yourusername/mercury.git
cd mercury
```
2. Install dependencies:
```bash
npm install
```
3. Set up environment variables in a `.env` file:
```bash
PORT =
NODE_ENV =
SENDER_NAME =
SENDER_ADDRESS =
SENDER_PASSWORD =
SERVER_HOST =
SERVER_PORT =
TOKEN_SECRET =
REFRESH_TOKEN_EXP_TIME =
TOKEN_EXP_TIME =
DEVELOPMENT_HOST =
DEVELOPMENT_USER =
DEVELOPMENT_PASSWORD =
DEVELOPMENT_DB =
DEVELOPMENT_DIALECT =
PRODUCTION_HOST =
PRODUCTION_USER =
PRODUCTION_PASSWORD =
PRODUCTION_DB =
PRODUCTION_DIALECT =
PASSWORD_RESET_BASE_URL =
REDIS_AUTH_PASSWORD =
REDIS_AUTH_PORT =
REDIS_AUTH_HOST =
MAILGUN_API_KEY =
MAILGUN_DOMAIN =
MAILGUN_HOST =
MAILGUN_SENDER =
DEFAULT_ADMIN_PASSWORD =
RECAPTCHA_SECRET_KEY =
```
4. Set up the PostgreSQL database and run migrations:Create a database for development and production in PostgreSQL.
Then, run the following commands to apply the migrations and seed the database:
```bash
npm run build
```
5. Start the development server:
```bash
npm run dev
```
The server will start at `http://localhost:3000`.### Redis Setup
Make sure Redis is running locally with the correct credentials. You can verify it with:```bash
redis-cli
```Ensure the connection matches the credentials in the `.env` file.
## Deployment
For deployment on production, configure the environment variables for your production database and email service, and ensure your server is running PostgreSQL and Redis.You can use `pm2` for production:
```bash
pm2 start npm --name mercury -- run start
```## Set Up NGINX (Optional):
If using NGINX as a reverse proxy, configure it to forward requests to your Node.js application running on port 3000 (or your specified port).
## Monitor and Maintain:
Monitor your application's performance and logs using pm2 logs and other monitoring tools. Ensure regular backups and security updates for your server environment.
## Access the Application:
Once deployed, access your Mercury application via your server's IP address or domain name (if configured).
# Additional Notes
Ensure firewall settings allow traffic on the configured ports (e.g., port 3000 for Node.js).
Secure sensitive data and credentials, especially in production environments.
Test thoroughly before deploying to production to avoid unexpected issues.
With these steps, your Mercury application should be successfully deployed and running in a production environment.