This repository contains the backend implementation of the project. It provides the necessary APIs and logic to power the frontend application and manage data efficiently.
The purpose of this project is to provide an intuitive and secure platform for apartment seekers to find rental properties, sign agreements, and communicate with landlords or admins. The platform is also designed for admins to efficiently manage and update apartment listings and agreements.
- LivingNest Website: https://living-nest-server.vercel.app
- Email:
[email protected]
- Password:
Admin36
- 🖥️ Client Site Repository: https://github.com/arman-miaa/Living-Nest-
-
User Authentication:
- Registration and login functionality with JWT-based authentication.
- Google login for quick authentication without needing a password.
- JWT token validation for protected routes.
-
Admin Panel:
- Admins can view and manage all members.
- Ability to update user status (user/member).
- Admins can post announcements.
- View all details about apartments, users, and members.
-
Members Dashboard:
- Members can view their payment history.
- Access to personal details.
-
Payment Management:
- Members can create payment records.
- Track payment details by members and status.
- Node.js: JavaScript runtime environment for building the backend API.
- Express.js: Web framework for Node.js used to build the API routes.
- JWT (JSON Web Tokens): Used for user authentication and authorization.
- MongoDB: NoSQL database for storing user, payment, and member data.
- Bcrypt.js: Password hashing library used for securely storing and verifying user passwords.
- Google OAuth: Enables Google login for users to authenticate without a password.
- Axios: For handling HTTP requests between the frontend and backend (used for communication in some parts of the application).
- Dotenv: For managing environment variables (e.g., JWT secret, database URL).
- @stripe/stripe-js: Stripe payment gateway integration.
- cors: Enables Cross-Origin Resource Sharing.
- dotenv: Securely manages environment variables.
- express: Node.js web framework for API development.
- jsonwebtoken: Handles user authentication and authorization with JWTs.
- mongodb: Interacts with the MongoDB database.
- stripe: Provides access to the Stripe API for payment processing.
- Node.js (>=14.0.0)
- MongoDB (or a MongoDB Atlas account)
- Stripe Account for payment integration
-
Clone the repository:
git clone https://github.com/your-repository-name
-
Navigate to the project directory:
cd your-repository-name
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory and add the following variables:PORT=5000 MONGO_URI=your-mongodb-uri JWT_SECRET=your-jwt-secret STRIPE_SECRET_KEY=your-stripe-secret-key GOOGLE_CLIENT_ID=your-google-client-id GOOGLE_CLIENT_SECRET=your-google-client-secret
-
Start the development server:
npm start
-
The backend will run on
http://localhost:5000
by default.
-
POST /auth/register: Register a new user.
- Request Body:
{ "name": "John Doe", "email": "[email protected]", "password": "securepassword" }
- Response:
{ "message": "User registered successfully", "token": "jwt-token" }
- Request Body:
-
POST /auth/login: Login a user.
- Request Body:
{ "email": "[email protected]", "password": "securepassword" }
- Response:
{ "message": "Login successful", "token": "jwt-token" }
- Request Body:
- GET /members: Retrieve all members (Admin only).
- PATCH /members/:id: Update a member's status (Admin only).
- POST /payments: Create a new payment record.
- GET /payments: Retrieve payment history for a user.
- GET /coupons: Retrieve all coupons.
- POST /coupons: Add a new coupon (Admin only).
- PATCH /coupons/:id: Update coupon availability (Admin only).
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
For any inquiries, please reach out to:
- Email: [email protected]