A disaster management platform that helps coordinate emergency response by allowing people to report their safety status, request resources, and manage relief operations through an admin dashboard.
- π Homepage - Central hub with server status and navigation
- β I Am Safe - Report personal safety status during emergencies
- π¦ Resource Requests - Submit requests for food, water, shelter, and medical aid
- π Admin Dashboard - View and manage all reports and requests
- π Secure Authentication - Password-protected admin access with bcrypt encryption
- πΎ Data Persistence - SQLite3 database for reliable data storage
- π¨ Responsive UI - Tailwind CSS styling for modern design
- Backend: Node.js, Express.js
- Template Engine: EJS
- Database: SQLite3
- Styling: Tailwind CSS
- Authentication: bcrypt, express-session
- Development Tools: Nodemon, Concurrently
Before you begin, ensure you have the following installed on your machine:
git clone https://github.com/dipanjan2907/Aapad-Net.git
cd Aapad-Netnpm install
This will install all the required packages listed in package.json:
- express
- sqlite3
- ejs
- tailwindcss
- bcrypt
- express-session
- dotenv
- And more...
Create a .env file in the root directory with the following variables:
SESSION_SECRET=your_secret_key_here PORT=3000 NODE_ENV=development
Note: Generate a strong SESSION_SECRET for production use. You can use:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"The SQLite database will be automatically created when you run the server for the first time. The database file (database.db) will appear in the root directory.
Runs the server with Nodemon (auto-reload on changes) and Tailwind CSS in watch mode:
npm run dev
This command:
- Watches for changes in your server code and automatically restarts
- Monitors CSS changes and rebuilds Tailwind styles
- Runs both processes concurrently
Runs the server without auto-reload:
npm start
If you need to manage CSS separately:
# Build CSS once npm run build:css # Watch CSS for changes (development) npm run watch:css
Once the server is running, open your browser and navigate to:
http://localhost:3000
You should see the AapadNet homepage with:
- Server status indicator
- Login link for admin access
- Navigation buttons for safe routes, resource requests, and admin dashboard
Aapad-Net/
βββ server.js # Express server setup and routes
βββ db.js # Database initialization and queries
βββ database.db # SQLite database (auto-created)
βββ package.json # Project dependencies
βββ tailwind.config.js # Tailwind CSS configuration
βββ postcss.config.js # PostCSS configuration
βββ .env # Environment variables (create this)
β
βββ views/ # EJS template files
β βββ index.ejs # Homepage
β βββ safe.ejs # I Am Safe form
β βββ request.ejs # Resource request form
β βββ admin.ejs # Admin dashboard
β
βββ public/ # Static files
β βββ style.css # Generated Tailwind CSS
β βββ input.css # Tailwind directives
β
βββ src/ # Source files
βββ input.css # Tailwind source configuration
| Route | Method | Description |
|---|---|---|
/ |
GET | Homepage |
/safe |
GET | I Am Safe page |
/safe |
POST | Submit safety status |
/request |
GET | Resource request page |
/request |
POST | Submit resource request |
/admin |
GET | Admin dashboard (protected) |
/login |
GET | Admin login page |
/login |
POST | Admin authentication |
-
Make sure you have a
postcss.config.jsfile with:export default { plugins: { tailwindcss: {}, autoprefixer: {}, }, };
-
Run the CSS build command:
npm run build:css
-
Ensure
views/**/*.ejsfiles are in the Tailwindcontentarray intailwind.config.js
Change the port in your .env file or kill the process using the port:
# On Windows netstat -ano | findstr :3000 taskkill /PID <PID> /F # On Mac/Linux lsof -i :3000 kill -9 <PID>
Delete the database.db file and restart the server. It will create a fresh database.
rm database.db npm run dev
- Server Changes: Edit
server.jsordb.js- Nodemon will auto-restart - Template Changes: Edit
.ejsfiles - refresh browser to see changes - Style Changes: Edit Tailwind classes directly in
.ejsfiles - watch mode will rebuild CSS - Database: Add queries in
db.jsand use them inserver.jsroutes
- Create a new EJS template in
views/newpage.ejs - Add route in
server.js:app.get("/newpage", (req, res) => { res.render("newpage"); });
- Server auto-restarts and route is live!
To expose your local server to the internet:
npx ngrok http 3000
Your SQLite database is stored as database.db. Backup by copying this file regularly.
-
Create a new branch for features:
git checkout -b feature/your-feature-name
-
Make your changes and test locally
-
Commit with descriptive messages:
git commit -m "Add: feature description" -
Push and create a pull request:
git push origin feature/your-feature-name
This project is licensed under the ISC License - see the package.json file for details.
If you encounter any issues:
- Check the troubleshooting section above
- Ensure all prerequisites are installed
- Verify your
.envfile is correctly configured - Check the terminal for error messages
- Open an issue on the GitHub repository
Made with β€οΈ in Bharat for disaster relief coordination