StarForge is a robust full-stack web application engineered with Node.js and the Express.js framework, utilizing MongoDB for persistent data storage via Mongoose. The application integrates a comprehensive suite of functionalities including secure user authentication (Passport.js with Google OAuth20 and bcrypt), efficient file uploads (Multer), dynamic email notifications (Nodemailer), and integrated payment processing through Razorpay. Advanced features encompass data export capabilities (ExcelJS, json2csv), image manipulation (Sharp), and browser automation (Puppeteer), all presented through an interactive user interface rendered with EJS templates.
The project adheres to a modular architecture, organizing functionalities into distinct directories to promote maintainability and scalability:
app.js: The primary entry point of the application, responsible for initializing the Express server, establishing database connections, and registering global middleware and routes.config/: Contains configuration files for various services, including database connection strings, API keys, and environment-specific settings.controllers/: Encapsulates the core business logic, handling incoming requests, interacting with models, and preparing data for view rendering or API responses.middlewares/: Houses custom Express middleware functions for cross-cutting concerns such as authentication, authorization, session management, and error handling.models/: Defines Mongoose schemas and models, representing the application's data structure and facilitating object-document mapping for MongoDB interactions.public/: Stores static assets including CSS stylesheets, client-side JavaScript files, and images, which are served directly to the browser.routes/: Manages the application's API endpoints and URL routing logic, directing incoming HTTP requests to the appropriate controller functions.scripts/: Contains standalone utility scripts for various operational tasks, such as database seeding, data migration, or scheduled background processes.util/: Provides general-purpose utility functions and helper modules designed to be reused across different components of the application.views/: Contains EJS template files responsible for rendering dynamic HTML content and constructing the user interface presented to clients.
Before setting up and running StarForge, ensure the following software is installed on your system:
- Node.js: Version 18.x or higher (LTS recommended).
- npm: Node Package Manager, which is bundled with Node.js.
- MongoDB: A running instance of MongoDB, accessible either locally or remotely.
Follow these steps to set up the StarForge project locally:
- Clone the repository:
git clone https://github.com/MuhammedFaazCC/StarForge.git
- Navigate to the project directory:
cd StarForge - Install project dependencies:
npm install
- Configure Environment Variables:
Create a
.envfile in the root directory of the project. This file will store sensitive information and configuration settings. Populate it with necessary variables such as:PORT(e.g.,3000)MONGODB_URI(e.g.,mongodb://localhost:27017/starforge_db)SESSION_SECRET(A strong, random string for Express sessions)GOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRET(for Google OAuth)RAZORPAY_KEY_ID,RAZORPAY_KEY_SECRET(for Razorpay payments)NODEMAILER_USER,NODEMAILER_PASS(for email service credentials)- Any other API keys or secrets required by the application.
To run the StarForge application after installation and configuration:
- Ensure MongoDB is running and accessible at the
MONGODB_URIspecified in your.envfile. - Start the application:
This command utilizes
npm start
nodemon(as configured inpackage.json) to automatically restart the server upon file changes during development. - Access the application:
Open your web browser and navigate to the address specified by your
PORTenvironment variable (e.g.,http://localhost:3000).