Music Sheet Application
Defines a Node.js/Express/MongoDB songbook manager for Khmer songs with custom fonts, user auth, and image uploads.
What this file does
Defines a Node.js/Express/MongoDB songbook manager for Khmer songs with custom fonts, user auth, and image uploads.
When to use it
- Building a multilingual songbook or lyrics app with custom font support
- Starting a Node.js/Express project with MongoDB and Passport auth
- Deploying a Replit-hosted app with autoscale and port 5000
- Managing song collections with role-based access and cover images
Assumes this stack
Music Sheet Application
Overview
This is a music sheet/songbook management application built with Node.js, Express, and MongoDB. It allows users to create, manage, and view songbooks with lyrics, particularly focused on Khmer (Cambodian) songs with custom font support.
Project Structure
- app.js: Main Express application configuration
- bin/www: Server startup script (configured for port 5000)
- models/: Mongoose data models
user.js: User authentication model with Passport.jssongbook.js: Songbook metadata modelsonglists.js: Song list model
- routes/: Express route handlers
index.js: Main routesbooks.js: Songbook management routessongs.js: Song management routesusers.js: User authentication routes
- views/: EJS templates for frontend
- public/: Static assets (CSS, JavaScript, fonts, images)
- uploads/: User-uploaded images for songs/books
Technology Stack
- Backend: Node.js 16.x with Express.js
- Database: MongoDB (Mongoose ODM)
- Authentication: Passport.js with Local Strategy
- Template Engine: EJS
- File Uploads: Multer
- Session Management: Cookie-session
Configuration
Environment Variables
DATABASEURL: MongoDB connection string (required)SESSION_SECRET: Secret key for session encryption (recommended for production)PORT: Server port (defaults to 5000 for Replit compatibility)
Current Setup Status
- ✅ Server configured to run on port 5000
- ✅ Server configured to bind to 0.0.0.0 for Replit proxy
- ✅ All dependencies installed
- ✅ MongoDB connection configured and working
- ✅ Application running successfully
- ✅ Deployment configured for autoscale
Database Setup
Setup Complete
The application is now connected to a working MongoDB database via the DATABASEURL environment variable.
Connection Features
- Automatic connection validation on startup
- Clear error messages if connection fails
- Helpful troubleshooting guidance in logs
If You Need to Change Database
Option 1: MongoDB Atlas (Recommended - Free)
- Go to https://www.mongodb.com/cloud/atlas
- Create a free account and cluster (M0 tier)
- Get connection string: Connect → Connect your application
- Update DATABASEURL secret in Replit with the new connection string
- Format:
mongodb+srv://username:password@cluster.mongodb.net/database?retryWrites=true&w=majority
Option 2: Alternative MongoDB Service
- Any MongoDB-compatible service will work
- Update DATABASEURL with your connection string
Option 3: Migrate to PostgreSQL
- Replit provides a built-in PostgreSQL database
- Would require converting Mongoose models to PostgreSQL (Sequelize/Prisma)
- Significant code changes needed
Running the Application
Development
The workflow is already configured. Once a valid DATABASEURL is set:
- The server will automatically restart
- Access the application through the Replit webview
- Server runs on port 5000
Deployment
Deployment configuration will be set up once the application runs successfully.
Features
- User authentication (signup/login)
- Role-based access (admin/operator)
- Songbook creation and management
- Song lyrics with custom Khmer fonts
- Image upload for book covers
- Search functionality
- Responsive design
Next Steps
- ✅ Install dependencies:
npm install(completed) - ✅ Configure server for Replit (completed)
- ✅ Set up valid MongoDB connection (completed)
- ✅ Test application functionality (completed)
- ✅ Configure deployment settings (completed)
Setup Complete! The application is ready to use and deploy.
Recent Changes (October 13, 2025)
- Imported project from GitHub
- Updated server to use port 5000 (Replit requirement)
- Changed server binding to 0.0.0.0 for Replit proxy compatibility
- Installed all npm dependencies
- Added MongoDB connection validation and error handling
- Configured deployment for autoscale
- Verified application functionality with screenshot testing
- Created comprehensive project documentation
What's inside
6 sections: overview, project structure, tech stack, config, database setup, features, and recent changes
Change this for your project
- Replace
DATABASEURLwith your own MongoDB connection string - Replace
SESSION_SECRETwith your own secret key - Replace
svprak/khmerlyricwith your own GitHub repository name
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Worth borrowing
- Separate route files by resource (books, songs, users) for modular Express apps
- Use environment variables for all configurable values like DB URL and session secret
Related Documents
GOOBY - Closing Store Marketplace
Defines a full-stack marketplace app for discovering closing retail stores in NY/NJ/CT/PA, with automated closure scanning and admin review.
Lua Code Obfuscator/Deobfuscator
Provides a full-stack web app for obfuscating and deobfuscating Roblox Lua scripts with a Monaco editor and PostgreSQL storage.
GREEN NODE - Project Overview
Describes a full-stack recycling platform with three runtime modes, provider architecture, and development scripts for Cochabamba, Bolivia.
ADN Systems DMR Peer Server
Documents a forked FreeDMR server for amateur radio DMR voice/data routing with bridges, proxies, scheduled voice announcements, and centralized security.