This project is a full-stack web application for managing university events, RSOs (Registered Student Organizations), and user interactions.
Before you begin, ensure you have the following installed:
- Node.js (which includes npm)
- Docker
- Docker Compose (usually included with Docker Desktop)
Follow these steps to get the application running locally:
-
Clone the Repository:
git clone <your-repository-url> cd <repository-directory>
-
Start the Database:
- The application uses a MariaDB database managed by Docker.
- Navigate to the project root directory.
- Run the provided script to start the database container in detached mode:
./startDb.sh
- Alternatively, you can use Docker Compose directly:
docker-compose up -d
- On the first run, Docker Compose will use the
backend/init.sqlscript to set up the database schema and create the necessary tables. - Database Connection Details:
- Host:
localhost - Port:
3306 - Username:
dbuser - Password:
dbpassword - Database Name:
event_system
- Host:
-
Configure Backend:
- Navigate to the backend directory:
cd backend - Create a
.envfile by copying the example:cp .env.example .env
- Important: Open the
.envfile and fill in the required environment variables. See the Environment Variables section below for details. You'll need to set the database credentials (which match the defaults indocker-compose.ymlunless you changed them) and generate secrets forSESSION_SECRETandJWT_SECRET. - Install backend dependencies:
npm install
- Navigate to the backend directory:
-
Configure Frontend:
- Navigate to the frontend directory from the project root:
cd ../frontend # Or just `cd frontend` if you are already in the root
- Install frontend dependencies:
npm install
- Navigate to the frontend directory from the project root:
You need to run both the backend and frontend servers concurrently.
-
Run the Backend Server:
- Open a terminal in the
backenddirectory. - Start the server (with automatic restarts on file changes using nodemon):
npm run dev
- Or, for production mode (though
devis usually preferred for local development):npm start
- The backend server will typically run on the port specified in your
backend/.envfile (default might be 3000 or 5000, checkserver.jsor.env).
- Open a terminal in the
-
Run the Frontend Development Server:
- Open another terminal in the
frontenddirectory. - Start the Vite development server:
npm run dev
- Vite will typically output the URL where the frontend is being served (usually
http://localhost:5173).
- Open another terminal in the
-
Access the Application:
- Open your web browser and navigate to the URL provided by the frontend Vite server (e.g.,
http://localhost:5173).
- Open your web browser and navigate to the URL provided by the frontend Vite server (e.g.,
The backend requires the following environment variables. Create a .env file in the backend directory and set these values:
# Database Configuration
DB_HOST=localhost # Or the IP/hostname if your DB is elsewhere
DB_USER=dbuser # Matches docker-compose.yml
DB_PASSWORD=dbpassword # Matches docker-compose.yml
DB_NAME=event_system # Matches docker-compose.yml
DB_PORT=3306 # Matches docker-compose.yml
# Application Secrets (Generate strong random strings for these)
SESSION_SECRET=your_strong_session_secret_here
JWT_SECRET=your_strong_jwt_secret_here
# Server Port
PORT=5000 # Or any other port for the backend API
Replace your_strong_session_secret_here and your_strong_jwt_secret_here with actual secure, random strings.
startDb.sh: Starts the MariaDB Docker container usingdocker-compose up -d.migration.sh: Warning: Destructive! Stops the database container, removes the data volume (deleting all data), restarts the container, and re-initializes the database usingbackend/init.sql. Use this to reset the database to a clean state.
npm install: Installs backend dependencies.npm start: Starts the backend server usingnode server.js.npm run dev: Starts the backend server usingnodemon server.jsfor development (auto-restarts on changes).npm test: (Currently prints an error message - needs test implementation).
npm install: Installs frontend dependencies.npm run dev: Starts the frontend development server using Vite.npm run build: Builds the frontend application for production.npm run lint: Lints the frontend code using ESLint.npm run preview: Serves the production build locally for previewing.