Skip to content

nxvafps/code4change

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code4Change

This project consists of a client-side Next.js application and a server-side Express application with PostgreSQL database.

Quick Start

  1. Clone this repository:
git clone https://github.com/nxvafps/code4change.git
cd code4change
  1. 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

Client Setup (Next.js)

The client is built with Next.js and bootstrapped using create-next-app.

Running the Client

  1. Navigate to the client directory:
cd client
  1. 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.

Server Setup (Express + PostgreSQL)

Prerequisites

  • Node.js and npm installed
  • PostgreSQL installed and running

Database Setup

  1. 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)

Environment Configuration

Create three environment files in the server/ directory:

  1. .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
  1. .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
  1. .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

GitHub OAuth Setup

To enable GitHub authentication:

  1. Go to your GitHub Developer Settings
  2. Create a new OAuth App
  3. Set the Homepage URL to http://localhost:3000
  4. Set the Authorization callback URL to http://localhost:3001/api/auth/github/callback
  5. Create the app and get your Client ID and Client Secret
  6. 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'))"

Running the Server

  1. Seed the database:
cd server
npm run seed
  1. Start the development server:
npm run dev

Additional Resources

Next.js Documentation

Contributing

NA

License

NA

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5

Languages