A modern web application built with Next.js 13, focusing on educational technology and student services.
This project as an experiment to see how a modern app (with features like authentication, subscriptions, API routes, static pages for docs ...etc) would work in Next.js 13 and server components. It integrates with Cashfree for payments and Prisma for database.
- New 
/appdir with Next.js 13 - Server and Client Components
 - Authentication using NextAuth.js
 - Database with Prisma and MySql
 - Payment integration with Cashfree
 - UI Components built using shadcn/ui
 - Styled using Tailwind CSS
 - Form handling with react-hook-form
 - Validations using Zod
 - Written in TypeScript
 
- Install dependencies using pnpm:
 
pnpm install- Copy 
.env.exampleto.env.localand update the variables: 
cp .env.example .env.local- Start the development server:
 
pnpm devRequired environment variables:
NEXTAUTH_URL=
NEXTAUTH_SECRET=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_ACCESS_TOKEN=
DATABASE_URL=
NEXT_PUBLIC_CASHFREE_APP_ID=
CASHFREE_SECRET_KEY=
- Create a Cashfree account at Cashfree Merchant Dashboard
 - Obtain your App ID and Secret Key from the Cashfree Dashboard
 - Set up your domain in the Cashfree Dashboard's allowed domains
 
Add the following environment variables to your .env file:
CASHFREE_APP_ID=your_app_id_here
CASHFREE_SECRET_KEY=your_secret_key_here
CASHFREE_API_ENDPOINT=https://sandbox.cashfree.com/pg # Use production URL for live
- 
Install Cashfree SDK
npm install cashfree-sdk - 
Initialize Cashfree in your application
 
import { Cashfree } from "cashfree-sdk"
const cashfree = new Cashfree({
  appId: process.env.CASHFREE_APP_ID,
  secretKey: process.env.CASHFREE_SECRET_KEY,
  environment: "sandbox", // Use 'production' for live
})- Test Mode vs Production Mode
 
- Use 
sandboxenvironment for testing - Switch to 
productionenvironment for live transactions - Update the API endpoint accordingly in your environment variables
 
- Always keep your Secret Key confidential
 - Implement proper error handling for payment failures
 - Test thoroughly in sandbox mode before going live
 - Follow Cashfree's security best practices
 - Maintain proper logs for transaction tracking
 
Licensed under the MIT license.