This project consists of a client-side Next.js application and a server-side Express application with PostgreSQL database.
- Clone this repository:
git clone https://github.com/nxvafps/code4change.git
cd code4change
- Install all dependencies (client and server):
npm run install:all
Or install separately:
npm run install:client # Install client dependencies only
npm run install:server # Install server dependencies only
The client is built with Next.js and bootstrapped using create-next-app
.
- Navigate to the client directory:
cd client
- Start the development server:
npm run dev
The application will be available at http://localhost:3000.
You can edit the page by modifying client/app/page.tsx
. The page auto-updates as you edit the file.
- Node.js and npm installed
- PostgreSQL installed and running
- Create the necessary databases using the setup script:
cd server
npm run setup-db
This will create three databases:
- code4change_dev (Development)
- code4change_test (Testing)
- code4change_prod (Production)
Create three environment files in the server/
directory:
.env.development
:
PGDATABASE=code4change_dev
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
GITHUB_CALLBACK_URL=http://localhost:3001/api/auth/github/callback
SESSION_SECRET=your_session_secret
.env.test
:
PGDATABASE=code4change_test
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
GITHUB_CALLBACK_URL=http://localhost:3001/api/auth/github/callback
SESSION_SECRET=your_session_secret
.env.production
:
PGDATABASE=code4change_prod
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
GITHUB_CALLBACK_URL=http://localhost:3001/api/auth/github/callback
SESSION_SECRET=your_session_secret
To enable GitHub authentication:
- Go to your GitHub Developer Settings
- Create a new OAuth App
- Set the Homepage URL to
http://localhost:3000
- Set the Authorization callback URL to
http://localhost:3001/api/auth/github/callback
- Create the app and get your Client ID and Client Secret
- Add these credentials to your environment files as shown above
The SESSION_SECRET
should be a long, random string to secure user sessions. You can generate one with:
node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"
- Seed the database:
cd server
npm run seed
- Start the development server:
npm run dev
- Next.js Documentation - features and API
- Learn Next.js - interactive tutorial
NA
NA