Skip to content

rashi-gupta-08/newbizz-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Newbizz β€” Full-Stack Business Landing & Admin Platform

A modern, production-ready full-stack web application built with Next.js, React, TypeScript, PostgreSQL, and Prisma. Features a beautiful landing page with multi-page routing, a working contact form with database persistence, Cal.com booking integration, and a password-protected admin dashboard to view submissions.

Live Demo: newbizz-react.vercel.app


🎯 Project Overview

Newbizz is a business landing page platform that showcases a services/SaaS company's offerings and captures leads. It combines a polished, animated frontend with a real backend infrastructure β€” making it a complete portfolio piece demonstrating full-stack web development skills.

Key Highlights

  • Real Database: PostgreSQL via Neon β€” contact submissions are persisted and queryable
  • Authentication: Cookie-based session auth (no external service required)
  • Admin Dashboard: Server-rendered page showing all submissions, stats, and filtering
  • Mobile-First: Responsive design with hamburger menu and touch-optimized interactions
  • Production-Ready: Deployed on Vercel with proper environment management and build optimization
  • Animations: Framer Motion for scroll reveals, page transitions, and interactive elements

πŸ› οΈ Tech Stack

Frontend

  • Next.js 16 β€” React framework with App Router, server/client components
  • React 18.3 β€” UI component library
  • TypeScript β€” Type-safe code across the stack
  • Tailwind CSS β€” Utility-first styling with custom design tokens
  • Framer Motion β€” Declarative animations (scroll reveals, micro-interactions, transitions)

Backend

  • Next.js API Routes β€” Serverless API endpoints for contact form & admin auth
  • PostgreSQL 15 β€” Relational database (hosted on Neon)
  • Prisma 5 β€” Type-safe ORM with auto-generated client
  • Node.js crypto β€” Session token generation and HMAC signing (no external auth library)

Database & ORM

  • Neon PostgreSQL β€” Free serverless PostgreSQL with auto-scaling
  • Prisma Migrate β€” Schema management and migrations
  • Prisma Studio β€” Visual database explorer

Deployment & DevOps

  • Vercel β€” Edge-optimized hosting for Next.js applications
  • GitHub β€” Source control with auto-deploy on push
  • dotenv β€” Environment variable management

Additional Integrations

  • Cal.com β€” Embedded booking calendar for scheduling calls
  • Node.js β€” Server runtime for API routes and build processes

✨ Features

Landing Pages

  • Home β€” Hero section with animated gradient orb, scroll-reveal sections, social proof stats
  • Services β€” Tiered service offerings with descriptions and durations
  • Pricing β€” Three pricing tiers with feature comparisons (Starter, Growth, Scale)
  • Book a Call β€” Embedded Cal.com calendar for scheduling 30-minute intro calls
  • Contact β€” Full-featured contact form with real-time validation and database persistence
  • Admin Login β€” Password-protected entry point to submissions dashboard

Contact Form (/contact)

  • Client-side form validation (email format, message length, etc.)
  • Server-side validation (defense-in-depth, no trusting client input)
  • Real-time error messaging with smooth animations
  • Success confirmation with animated checkmark
  • Data persists to PostgreSQL database

Admin Dashboard (/admin/dashboard)

  • Password-protected (HTTP-only cookie session token)
  • Real-time stats: total submissions, last 7 days, unique companies
  • Sortable table view of all contact submissions
  • Displays name, email, company, message, and received date
  • Server-rendered for security (auth happens server-side)
  • Log out functionality that clears session cookie

Navigation & UX

  • Sticky header with scroll-aware background blur
  • Desktop nav bar with animated active-link underline
  • Mobile hamburger menu (three-line icon β†’ βœ• animation)
  • Auto-closing menu on route change
  • Focus-ring keyboard accessibility on all buttons/links
  • Dark theme with accent orange (#ED834E)

Performance & Accessibility

  • Next.js Turbopack for fast dev builds
  • Image optimization (lazy loading, srcset)
  • Semantic HTML with ARIA labels
  • Keyboard navigation support
  • Respects prefers-reduced-motion for accessibility
  • Mobile-responsive breakpoints (sm: 640px, md: 768px, lg: 1024px)

πŸ“‚ Project Structure

newbizz-react/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ layout.tsx              # Root layout with fonts & providers
β”‚   β”‚   β”œβ”€β”€ page.tsx                # Home page
β”‚   β”‚   β”œβ”€β”€ globals.css             # Global styles
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   └── page.tsx            # Services page
β”‚   β”‚   β”œβ”€β”€ pricing/
β”‚   β”‚   β”‚   └── page.tsx            # Pricing page
β”‚   β”‚   β”œβ”€β”€ book/
β”‚   β”‚   β”‚   └── page.tsx            # Cal.com booking page
β”‚   β”‚   β”œβ”€β”€ contact/
β”‚   β”‚   β”‚   └── page.tsx            # Contact form page
β”‚   β”‚   β”œβ”€β”€ admin/
β”‚   β”‚   β”‚   β”œβ”€β”€ login/
β”‚   β”‚   β”‚   β”‚   └── page.tsx        # Admin login form
β”‚   β”‚   β”‚   └── dashboard/
β”‚   β”‚   β”‚       └── page.tsx        # Admin submissions dashboard
β”‚   β”‚   └── api/
β”‚   β”‚       β”œβ”€β”€ contact/
β”‚   β”‚       β”‚   └── route.ts        # Contact form API endpoint
β”‚   β”‚       └── admin/
β”‚   β”‚           β”œβ”€β”€ login/
β”‚   β”‚           β”‚   └── route.ts    # Admin login API endpoint
β”‚   β”‚           └── logout/
β”‚   β”‚               └── route.ts    # Admin logout API endpoint
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ prisma.ts               # Prisma client singleton
β”‚   β”‚   └── auth.ts                 # Session token & password auth
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ Nav.tsx                 # Navigation with mobile menu
β”‚   β”‚   β”œβ”€β”€ Footer.tsx              # Footer
β”‚   β”‚   β”œβ”€β”€ Hero.tsx                # Hero section
β”‚   β”‚   β”œβ”€β”€ Reveal.tsx              # Scroll-reveal animation wrapper
β”‚   β”‚   β”œβ”€β”€ ContactForm.tsx         # Contact form component
β”‚   β”‚   └── LogoutButton.tsx        # Logout button for admin
β”‚   └── middleware.ts               # Edge middleware for auth guard
β”œβ”€β”€ prisma/
β”‚   └── schema.prisma               # Database schema & models
β”œβ”€β”€ public/                         # Static assets
β”œβ”€β”€ .env                            # Environment variables (gitignored)
β”œβ”€β”€ .env.example                    # Template for env vars
β”œβ”€β”€ .gitignore                      # Git exclusions
β”œβ”€β”€ package.json                    # Dependencies & scripts
β”œβ”€β”€ tsconfig.json                   # TypeScript configuration
β”œβ”€β”€ tailwind.config.ts              # Tailwind CSS configuration
β”œβ”€β”€ postcss.config.js               # PostCSS configuration
β”œβ”€β”€ next.config.js                  # Next.js configuration
β”œβ”€β”€ vercel.json                     # Vercel build configuration
└── README.md                       # This file

πŸš€ Getting Started

Prerequisites

  • Node.js 18.17+ (check with node --version)
  • npm or yarn package manager
  • Git

Installation

  1. Clone the repository (or download from GitHub):

    git clone https://github.com/rashi-gupta-08/newbizz-react.git
    cd newbizz-react
  2. Install dependencies:

    npm install
  3. Set up environment variables:

    • Copy .env.example to .env:
      cp .env.example .env
    • Fill in the three required values:
      • DATABASE_URL β€” PostgreSQL connection string from Neon
      • ADMIN_PASSWORD β€” Password you'll use to log into the admin panel
      • SESSION_SECRET β€” Long random string (generate with node -e "console.log(require('crypto').randomBytes(32).toString('hex'))")
  4. Run the database migration (creates tables):

    npx prisma migrate dev --name init
  5. Start the dev server:

    npm run dev

    Open http://localhost:3000 in your browser.

Development Commands

npm run dev          # Start dev server (with hot reload)
npm run build        # Build for production
npm start            # Start production server
npm run lint         # Run ESLint
npm run db:migrate   # Create a new migration
npm run db:studio    # Open Prisma Studio (visual database editor)

πŸ—„οΈ Database Setup

Using Neon (Recommended)

  1. Go to neon.tech and sign up (GitHub login is fastest)
  2. Create a new project
  3. Copy your connection string (labeled "Pooled connection")
  4. Paste it as DATABASE_URL in your .env file
  5. Run npx prisma migrate dev to create tables

Running Migrations

Every time you update prisma/schema.prisma, create a migration:

npx prisma migrate dev --name describe_your_change

This generates a SQL migration file and applies it to your database.

Viewing Data

Open Prisma Studio to browse/edit data visually:

npm run db:studio

πŸ” Environment Variables

Create a .env file in the project root (see .env.example):

# PostgreSQL connection string from Neon
# Format: postgresql://user:password@host/dbname?sslmode=require
DATABASE_URL=postgresql://neondb_owner:...

# Password to log into /admin/login
ADMIN_PASSWORD=YourStrongPasswordHere

# Long random string for signing session tokens
# Generate: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
SESSION_SECRET=a3f8c2d1e9b7...64_random_characters...

Important: Never commit .env to Git. It contains your database password and should stay local only.


🚒 Deployment

Deploy to Vercel

  1. Push your code to GitHub:

    git add .
    git commit -m "Your commit message"
    git push
  2. Import project on Vercel:

    • Go to vercel.com/new
    • Click "Import" next to your GitHub repository
    • Vercel auto-detects Next.js β€” leave build settings as-is
    • Click Deploy
  3. Set environment variables on Vercel:

    • In your project dashboard, go to Settings β†’ Environment Variables
    • Add DATABASE_URL, ADMIN_PASSWORD, and SESSION_SECRET
    • Vercel will redeploy automatically
  4. Your site is live!

    • Vercel assigns a URL like newbizz-react-yourname.vercel.app
    • Every git push triggers an automatic redeploy

Production Checklist

  • βœ… .env is in .gitignore (secrets never pushed)
  • βœ… Environment variables set on Vercel
  • βœ… Database is live and connected
  • βœ… Form submissions persist to database
  • βœ… Admin dashboard is password-protected
  • βœ… SSL/HTTPS enabled (Vercel does this automatically)

πŸ“Š Database Schema

ContactSubmission Table

model ContactSubmission {
  id        String   @id @default(cuid())
  name      String
  email     String
  company   String?
  message   String
  createdAt DateTime @default(now())

  @@index([createdAt])
}
Field Type Notes
id String Unique identifier (CUID)
name String Contact's full name
email String Contact's email address
company String? Contact's company (optional)
message String Message body
createdAt DateTime Submission timestamp (auto-set)

πŸ” Authentication & Security

Admin Login Flow

  1. User visits /admin/login and enters password
  2. POST to /api/admin/login with password
  3. Server validates against ADMIN_PASSWORD env var
  4. On success, server generates a signed session token:
    • Token = <timestamp>.<hmacSignature>
    • Signature is HMAC-SHA256 of timestamp using SESSION_SECRET
  5. Token stored in HTTP-only secure cookie
  6. Subsequent requests to /admin/dashboard check cookie validity
  7. Session expires after 7 days

Form Validation

  • Client-side: Real-time error feedback as user types
  • Server-side: Double-checks all inputs before database write
  • Prevents malformed data and SQL injection attacks

🎨 Design & Branding

Color Palette

  • Background: #0A0A0C (near-black)
  • Surface: #131316 (slightly lighter)
  • Accent: #ED834E (warm orange)
  • Text: #F5F3EF (off-white)
  • Muted: #8A8782 (gray for secondary text)

Typography

  • Display: Space Grotesk (headings, brand)
  • Body: Inter (paragraph text, form labels)

Animations

  • Scroll reveals on sections (fade + slide up)
  • Drifting gradient orb behind hero
  • Animated hamburger menu (☰ β†’ βœ•)
  • Micro-interactions on buttons and links
  • Respects prefers-reduced-motion for accessibility

πŸ“ˆ Performance Metrics

  • Core Web Vitals: Optimized for Largest Contentful Paint, First Input Delay, Cumulative Layout Shift
  • Turbopack: Next.js 16 uses Turbopack for ~3x faster builds
  • Database: Neon's auto-scaling handles traffic spikes
  • CDN: Vercel's global edge network serves content from closest region
  • Caching: Automatic caching of static pages and assets

πŸ“ License

This project is open source and available under the MIT License β€” feel free to use it as a template for your own projects.


πŸ’¬ Questions?

This README documents the architecture, setup, and deployment of a full-stack web application suitable for production use. For questions or issues:

  1. Check the Next.js documentation
  2. Review Prisma docs
  3. See Vercel deployment guide

Built with Next.js, React, TypeScript, Tailwind CSS, Framer Motion, PostgreSQL, Prisma, and deployed on Vercel.

Live: newbizz-react.vercel.app

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors