A secure and scalable backend service for the ConvoSphere chat application, built with Node.js, Express, bcrypt, jsonwebtoken, and PostgreSQL.
- Introduction
- Features
- Tech Stack
- Setup Instructions
- Project Structure
- API Endpoints
- Contributing
- License
ConvoSphere(Backend) is the backend service for the ConvoSphere chat application. It handles authentication, user management, and database interactions, ensuring a secure and efficient chat experience.
- User Authentication: Secure login and registration using bcrypt and JWT.
- Real-Time Communication: Provides APIs for real-time messaging.
- PostgreSQL Integration: A robust and scalable relational database.
- Middleware: Efficient request handling with Express middleware.
- Development Convenience: Nodemon for automatic server restarts during development.
- Node.js: JavaScript runtime for server-side development.
- Express.js: Fast and minimal web framework.
- bcrypt: Password hashing library.
- jsonwebtoken: For secure token-based authentication.
- PostgreSQL: Reliable and scalable database.
- Nodemon: For seamless development experience.
- Node.js
- PostgreSQL
- A code editor (e.g., VS Code)
-
Clone the repository:
git clone https://github.com/FluttX/convo_sphere-app-backend.git
-
Navigate to the project directory:
cd convo_sphere-app-backend
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory and configure the following variables:PORT=5000 DB_HOST=localhost DB_USER=your_pg_user DB_PASSWORD=your_pg_password DB_NAME=convosphere JWT_SECRET=your_secret_key
-
Start the PostgreSQL server and create the database and tables:
CREATE DATABASE convo_sphere;
and other sql tables that is on
project_sql_file.sql
. -
Run the server in development mode:
npm run dev
convo_sphere-app-backend/
├── controllers/ # Request handling logic
├── middleware/ # Custom middleware
├── models/ # Database models
├── routes/ # API routes
├── utils/ # Utility functions
├── .env # Environment variables
├── server.js # Entry point of the application
└── package.json # Dependencies and scripts
- POST /api/auth/register: Register a new user.
- POST /api/auth/login: Login and receive a JWT.
- GET /api/users: Retrieve a list of users.
- GET /api/users/:id: Retrieve user details by ID.
- POST /api/messages: Send a new message.
- GET /api/messages/:conversationId: Retrieve messages by conversation ID.
We welcome contributions! Follow these steps to contribute:
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add feature name"
- Push your branch:
git push origin feature-name
- Submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.