Skip to content

A full-stack web application with Google OAuth authentication and Stripe payment processing. Built with Node.js/Express backend and React frontend.

Notifications You must be signed in to change notification settings

ahmedrzakhan/PaySchool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PaySchool Application

A full-stack web application with Google OAuth authentication and Stripe payment processing. Built with Node.js/Express backend and React frontend.

Features

  • User Authentication: Secure Google OAuth 2.0 login/signup
  • JWT Sessions: Stateless authentication with JSON Web Tokens
  • Stripe Payments: Save payment methods and process invoices
  • User Profiles: Display user information after login
  • Security: Implementation of Helmet, CORS, and NoSQL injection sanitization
  • Logging: Detailed backend logging with Bunyan

Tech Stack

Backend

  • Framework: Node.js, Express.js
  • Database: MongoDB (Mongoose ODM)
  • Authentication: Passport.js (Google OAuth), JWT
  • Payments: Stripe SDK
  • Logging: Bunyan
  • Security: Helmet, CORS, express-mongo-sanitize

Frontend

  • Library: React
  • Routing: React Router DOM
  • HTTP Client: Axios
  • Payments: Stripe.js, React Stripe.js
  • Build Tool: Create React App

Prerequisites

Before you begin, ensure you have:

Setup Instructions

  1. Clone the Repository

    git clone https://github.com/ahmedrzakhan/payschool.git
    cd payschool
  2. Backend Setup

    • Navigate to backend directory and install dependencies
    • Configure environment variables in .env file (see example below)
    • Start the development server
  3. Frontend Setup

    • Navigate to client directory and install dependencies
    • Configure environment variables in .env file (see example below)
    • Start the development server

Environment Variables

Backend (.env)

NODE_ENV=development
PORT=8200
MONGO_URI=mongodb://localhost:27017/payschool
JWT_SECRET=your_strong_jwt_secret
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_CALLBACK_URL=http://localhost:8200/api/v1/auth/google/callback
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key

Frontend (.env)

REACT_APP_API_BASE_URL=http://localhost:8200/api/v1
REACT_APP_STRIPE_PUBLISHABLE_KEY=pk_test_your_stripe_publishable_key

Running the Application

  1. Start Backend

    cd backend
    npm run dev

    Server runs on http://localhost:8200

  2. Start Frontend

    cd client
    npm start

    Opens http://localhost:3000 in your browser

API Endpoints

Base URL: /api/v1

Authentication

  • GET /auth/google - Initiate Google OAuth flow
  • GET /auth/google/callback - Handle OAuth callback
  • POST /auth/logout - Log out user

User

  • GET /user/profile - Get current user profile

Payments

  • POST /payment/stripe/setup-intent - Create a Stripe Setup Intent
  • POST /payment/stripe/create-invoice - Create a new invoice
  • PUT /payment/stripe/set-default-payment-method - Update default payment method

Project Structure

payschool/
├── backend/              # Node.js/Express server
│   ├── src/
│   │   ├── server.js     # Entry point
│   │   ├── configs/      # Configuration files
│   │   ├── middlewares/  # Express middleware
│   │   ├── models/       # Mongoose models
│   │   └── routes/       # API routes
│   └── package.json
└── client/               # React frontend
    ├── public/           # Static assets
    ├── src/
    │   ├── components/   # Reusable components
    │   ├── pages/        # Page components
    │   ├── services/     # API services
    │   ├── App.js        # Main component
    │   └── index.js      # Entry point
    └── package.json

Usage Flow

  1. User visits the application homepage
  2. User logs in with Google OAuth
  3. User is redirected to profile page after successful authentication
  4. User can add a payment method via Stripe
  5. User can create and pay invoices

About

A full-stack web application with Google OAuth authentication and Stripe payment processing. Built with Node.js/Express backend and React frontend.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published