Skip to content

vixeln/CSC317-ClassManager

 
 

Repository files navigation

Class Manager

A class management system for students to register and manage classes with ease and style.Unlike the SFSU Student Center, our app is simple and fast and does not require users to wait 15 to 30 seconds just for it to respond.

Features

  • Look up classes for Computer Science majors as a student
  • Register or log into your student account
    • Edit user name or profile image
  • Manage classes in your semester schedule
    • Add a class to your schedule
    • Remove a class from your schedule
    • Clear your schedule

Project Structure

.
├── app.js                     # Application entry point
├── package.json               # NPM project configuration
├── README.md                  # This file
├── config/                    # Configuration files
│   ├── database.js            # PostgreSQL connection pool
│   ├── test-classes.json      # Dummy data to populate classes table
│   └── test-courses.json      # Dummy data to populate courses table
├── controllers/               # Route controllers
│   ├── authController.js      # Authentication logic
│   ├── courseController.js    # Logic to interact with courses on the database
│   ├── scheduleController.js  # User-related logic
│   └── userController.js      # User-related logic
├── middlewares/               # Custom middleware
│   ├── auth.js                # Authentication middleware
│   ├── error-handler.js       # Error handling middleware
│   ├── locals.js              # Template locals middleware
│   └── upload.js              # File upload middleware
├── models/                    # Database operations
│   ├── Class.js               # User data access functions
│   ├── Course.js              # User data access functions
│   ├── Image.js               # Profile image data access functions
│   ├── Registration.js        # Class registration access functions
│   └── User.js                # User data access functions
├── public/                    # Static assets
│   ├── css/
│   ├── js/
│   └── images/
├── routes/                    # Express routes
│   ├── auth.js                # Authentication routes
│   ├── courses.js             # Class search page and api routes
│   ├── index.js               # Public routes
│   ├── schedule.js            # User-added classes page and api routes
│   └── user.js                # Protected user routes
├── scripts/                   # Utility scripts
│   ├── clean-db.js            # Reset database tables
│   ├── test-db.js             # Test js functions on database
│   └── init-db.js             # Database initialization
└── views/                     # EJS templates
    ├── partials/              # Reusable template parts (header, footer, etc.)
    ├── auth/                  # Authentication templates
    ├── schedule/              # User's registered classes page
    ├── courses/               # List of courses page
    └── user/                  # User-related templates

Getting Started

Prerequisites

  • Node.js (v18 or higher)
  • PostgreSQL (v18.*)

Installation

  1. Fork and clone the repository:
# Fork on GitHub first, then clone your fork
git clone https://github.com/Vixeln/CSC317-ClassManager.git
cd CSC317-ClassManager
  1. Install dependencies:
npm install
  1. Create a .env file in the root directory:
cp .env.example .env
  1. Modify the .env file with your configuration:
PORT=3000
NODE_ENV=development
DATABASE_URL=postgresql://postgres:[your_password]@localhost:5432/csc317_project
SESSION_SECRET=your_secure_secret_key
  1. Create the database and initialize tables:
createdb csc317_project
npm run db:init

This script will also populate the tables with dummy classes and courses

  1. Start the development server:
npm run dev
  1. Open your browser and visit http://localhost:3000

Development

Running in Development Mode

npm run dev

This will start the server with nodemon, which automatically restarts when files change.

Test javascript code on the database

Write javascript in scripts/test-db.js and test it by running

npm run db:test

Running in Production Mode

npm start

Deployment

For deployment to Render.com:

  1. Create a PostgreSQL database on Render
  2. Create a Web Service connected to your GitHub repository
  3. Set environment variables (DATABASE_URL, SESSION_SECRET, NODE_ENV)
  4. Initialize the database using Render Shell: npm run db:init

See SETUP.md for detailed deployment instructions.

License

This project is available for educational purposes.

Acknowledgments

  • This project was built on top of the authentication template provided by @goleador
  • Built with Express.js, PostgreSQL, and other open-source technologies

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 72.9%
  • EJS 17.8%
  • CSS 9.3%