This repository contains the backend for the Bunlar project, a platform for structured, constructive online debates. The backend is built using NestJS and deployed on AWS Lambda using the Serverless Framework.
Before you can run the project, ensure you have the following installed:
-
Node.js (version 16.x.x or higher)
-
npm (comes with Node.js)
-
Serverless Framework (Globally installed):
npm install -g serverless
-
Clone the repository:
`git clone https://github.com/ilkeozi/bunlar-backend.git` `cd bunlar-backend`
-
Install the dependencies:
npm install
Before running the project, compile the TypeScript code into JavaScript:
npm run build
You’ll need to set up your environment variables by creating a .env
file in the root directory. Example:
MONGO_URI=mongodb://localhost:27017/bunlar-dev JWT_SECRET=your-secret-key
You can emulate the AWS Lambda environment locally using the serverless-offline plugin. To run the project locally:
npm run offline
The API will be available at http://localhost:3000
.
Alternatively, you can run the NestJS server in development mode with hot-reloading:
npm run start:dev
This will run the backend without the AWS Lambda simulation but with hot-reloading enabled for rapid development.
Here are some of the key scripts available in the project:
-
Build: Compile the project:
npm run build
-
Start Development: Run the NestJS project in development mode:
npm run start:dev
-
Run Offline: Simulate the Lambda environment locally:
npm run offline
-
Lint: Run the linter:
npm run lint
-
Test: Run unit tests:
npm run test
The project uses Jest for testing. To run the tests:
npm run test
For watching tests during development:
npm run test:watch
This project uses the Serverless Framework to deploy to AWS Lambda. To deploy the project, run:
sls deploy
Make sure you have AWS credentials configured in your environment.
Contributions are welcome! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature
). - Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/your-feature
). - Open a Pull Request.
Please ensure that your code follows the existing style and includes tests. We also ask that all contributions adhere to the Code of Conduct.
To create a welcoming environment for all contributors, we encourage all participants to read and adhere to our Code of Conduct.
This project is licensed under the GNU General Public License v3.0. You can freely use, modify, and distribute this software under the terms of this license.
For more details, see the LICENSE file.