A basic Express.js backend server with a modular structure and Firebase integration.
- Install dependencies:
npm install- Create a
.envfile in the root directory and add your environment variables:
PORT=5000
- Set up Firebase:
- Go to the Firebase Console
- Create a new project or select an existing one
- Go to Project Settings > General
- Scroll down to "Your apps" section
- Click on the web icon (</>)
- Register your app with a nickname
- Copy the Firebase configuration object
- Save it as
firebase_key.jsonin the backend root directory
Development mode (with auto-reload):
npm run devProduction mode:
npm startGET /: Welcome messageGET /api/health: Health check endpoint
backend/
├── node_modules/
├── routes/
│ └── index.js
├── controller/
│ └── firebaseSetting.js
├── utils/
│ └── jsonLoader.js
├── .env
├── .gitignore
├── firebase_key.json
├── package.json
├── README.md
└── server.js