Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pocket Coach — Student Management Portal

A web portal for coaching institutes to manage students, batches, branches, admins, and payments.


Before You Start

You need three things installed on your computer. Do these first.

1. Git

Download and install from: https://git-scm.com/downloads

Verify:

git --version

2. Node.js (v18 or higher)

Download and install from: https://nodejs.org — choose the LTS version.

Verify:

node --version
npm --version

3. PostgreSQL (v14 or higher)

Download and install from: https://www.postgresql.org/download

During installation:

  • When it asks for a password for the postgres user — set one and write it down. You will need it.
  • Leave the port as 5432.

Verify PostgreSQL is running after installation:

pg_isready

Expected: localhost:5432 - accepting connections


Step 1 — Clone the Project

git clone https://github.com/mahbub-alam-prithibi/sms-pocketcoach.git
cd sms-pocketcoach

Step 2 — Create the PostgreSQL User Password in the .env File

Go into the backend folder and copy the example environment file:

# Mac / Linux
cp backend/.env.example backend/.env

# Windows (Command Prompt)
copy backend\.env.example backend\.env

# Windows (PowerShell)
Copy-Item backend/.env.example backend/.env

Open backend/.env in any text editor and find this line:

DB_PASSWORD=postgres

Replace postgres with the password you set when you installed PostgreSQL.

Also change the JWT_SECRET to any long random string of your choice:

JWT_SECRET=change-this-to-something-long-and-random

Save the file.


Step 3 — Create the Database

Open your terminal and connect to PostgreSQL:

psql -U postgres -h localhost

Enter your PostgreSQL password when prompted.

Once inside, run:

CREATE DATABASE pocket_coach_portal;

Then exit:

\q

Step 4 — Run the Setup Script

From the project root folder, run:

bash setup.sh

Windows users: If bash is not available, install Git for Windows — it comes with Git Bash. Open Git Bash and run the command above.

This script will automatically:

  • Install all backend dependencies
  • Start the backend server (which creates all database tables)
  • Create your Super Admin account
  • Install all frontend dependencies

When it finishes you will see:

============================================================
  Setup complete!
  Backend  ->  http://localhost:3000
  Frontend ->  http://localhost:5173

  Log in with:
  Mobile:   01700000000
  Password: yourpassword
============================================================

Before running the script, open setup.sh in a text editor and update the Super Admin credentials at the top of the file to your preferred phone number and password:

ADMIN_MOBILE="01700000000"
ADMIN_PASSWORD="yourpassword"

Step 5 — Start the Servers

After setup is done, every time you want to run the project again open two terminal windows:

Terminal 1 — Backend:

cd backend
npm run dev

You should see:

🚀 Server running on port 3000
✅ Database connected & synced

Terminal 2 — Frontend:

cd frontend
npm run dev

You should see:

➜  Local:   http://localhost:5173/

Open your browser and go to http://localhost:5173

Log in with the mobile number and password you set in setup.sh.


Resetting Everything

If you want to wipe all data and start completely fresh:

psql -U postgres -h localhost -d pocket_coach_portal -c "TRUNCATE TABLE student_payments, \"StudentBatches\", \"BatchBranches\", students, batches, categories, branches, users RESTART IDENTITY CASCADE;"

Then create a new Super Admin:

curl -X POST http://localhost:3000/users/superadmin \
  -H "Content-Type: application/json" \
  -d '{"fullName":"Super Admin","mobile":"01700000000","password":"yourpassword"}'

Troubleshooting

pg_isready says "No such file or directory" PostgreSQL is not installed or not added to your PATH. Re-install it and make sure to check "Add to PATH" during installation.

psql: error: connection to server failed PostgreSQL is not running. On Windows, open Services and start "postgresql-x64-xx". On Mac, run brew services start postgresql.

CREATE DATABASE fails with "already exists" The database was already created. You can skip Step 3.

Backend crashes with "password authentication failed" The DB_PASSWORD in backend/.env does not match your PostgreSQL password. Open the file and correct it.

curl: Super admin already exists A Super Admin was already created. Skip the curl command. If you want a different account, reset the data first (see Resetting Everything above).

Port 3000 or 5173 already in use Another process is using that port. Run:

npx kill-port 3000 5173

Then start the servers again.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages