This document explains how to set up and run the backend locally.
- Node.js (v20 or later)
- npm (comes with Node.js)
- MongoDB (local or Atlas connection)
- Clone the repo
git clone https://github.com/OpenCodeChicago/hacktoberfest-2025-backend.git cd hacktoberfest-2025-backend - Install dependencies
npm install
- Set up environment variables
Copy
.env.exampleto.env:Editcp .env.example .env
.envand fill in your own values forMONGODB_URIand other variables. Example:PORT=5000 # Local MongoDB MONGODB_URI=mongodb://localhost:27017/hacktoberfest # or MongoDB Atlas # MONGODB_URI=mongodb+srv://<user>:<password>@cluster.mongodb.net/hacktoberfest
- Seed the database
Run the seed script to populate your local database with sample data:
npm run seed
- Start the server
By default the API will be available at
npm run dev
http://localhost:5000
npm run dev→ start server with auto-reload (Nodemon)npm run start→ start production servernpm run lint→ run ESLint checksnpm run test→ run tests (if available)
- Build the image
docker build -t hacktoberfest-backend . - Run the container
docker run -d -p 5000:5000 --env-file .env hacktoberfest-backend
Note: Automated CI checks are included and run on every push or pull request via GitHub Actions. See the Actions tab on GitHub for results.
- Fork this repository
- Create a new branch for your feature or fix
- Commit your changes
- Open a Pull Request (PR) with a clear description of what you did
For more details, see CONTRIBUTING.md
- If you see an error like command not found: npm, make sure Node.js and npm are installed.
- If the dev server doesn’t start, try deleting
node_modulesandpackage-lock.json, then runnpm installagain. - Still stuck? Ask in main Hacktoberfest Discussion or on Discord
If you find this project helpful, please consider starring it on GitHub! It helps us grow and reach more contributors.