FiliPort2 is a Node.js web application for managing projects, contacts, and comments. It uses Express, Handlebars for templating, and a modular router structure.
- Project, contact, and comment management
- RESTful routing with Express
- Handlebars-based views
- Static assets in the public directory
app.js: Main application entry pointdb.js: Database connection and logicrouters/: Express routers for different resourcesviews/: Handlebars templates for pages and layoutspublic/: Static files (CSS, images)
- Install dependencies:
npm install
- Configure environment variables (create a
.envfile in the project root).SESSION_SECRETis required; others are optional:To generate a bcrypt hash:SESSION_SECRET=<a long random string> ADMIN_USERNAME=Filmon # optional: seeds initial admin user ADMIN_PASSWORD_HASH=... # optional: hash of admin password PORT=8080 NODE_ENV=development
node -e "console.log(require('bcrypt').hashSync('yourpassword', 10))" - Start the application:
npm start
- Visit
http://localhost:8080in your browser.
- User Management – registration at
/users/register, database-backed login (no hard-coded admin) - Input Validation –
express-validatoron all forms, auto-sanitization & XSS protection - Request Logging – Morgan logs all HTTP requests
- Error Handling – centralized error middleware, console logging
- Tests – Jest/Supertest suite; run
npm test - HTTPS Support – set
HTTPS_KEYandHTTPS_CERTenv vars to enable TLS - Security – CSRF tokens on all forms, secure session cookies, Helmet headers
npm start: Start the servernpm test: Run Jest test suite
- Never commit
.env(secrets) – only.env.example - In production: set
NODE_ENV=productionfor secure cookies - Use a reverse proxy (Nginx, etc.) or the HTTPS env vars for TLS
- Ensure
SESSION_SECRETis long and random
MIT