Skip to content

RamonsArchive/DigitalRevolution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

135 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌐 Digital Revolution - E-Commerce Platform

A comprehensive e-commerce platform dedicated to bridging the digital divide through technology education and community empowerment. Built with modern web technologies and designed to support STEM education initiatives.

🎯 Mission Statement

Digital Revolution is a foundation committed to creating pathways from digital exclusion to STEM opportunities. We believe technology should serve democratic values and create opportunities for all communities. Our platform sells products where 50% of profits go directly to digital equity and STEM education initiatives, ensuring every purchase contributes to closing the digital divide.

Our Impact Areas:

  • Digital Literacy: Empowering communities with essential technology skills
  • STEM Education: Creating opportunities in Science, Technology, Engineering, and Mathematics
  • Community Building: Fostering inclusive technology ecosystems
  • Democratic Values: Ensuring technology serves the public good

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm, yarn, pnpm, or bun
  • MySQL database
  • Stripe account for payments
  • Printful account for product fulfillment
  • Resend account for email services

Installation

  1. Clone the repository
git clone https://github.com/yourusername/digital-revolution.git
cd digital-revolution
  1. Install dependencies
npm install
# or
yarn install
# or
pnpm install
  1. Set up environment variables
cp .env.example .env.local
  1. Configure your environment variables
# Database
DATABASE_URL="mysql://username:password@localhost:3306/digital_revolution"

# NextAuth
NEXTAUTH_SECRET="your-secret-key"
NEXTAUTH_URL="http://localhost:3000"
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"

# Stripe
STRIPE_SECRET_KEY="sk_test_..."
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_..."

# Printful
DIGITAL_REVOLUTION_API_KEY="your-printful-api-key"

# Resend
RESEND_API_KEY="re_..."

# App URL
NEXT_PUBLIC_APP_URL="http://localhost:3000"
  1. Set up the database
npx prisma generate
npx prisma db push
  1. Run the development server
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 to see the application.

πŸ—οΈ Project Structure

digital-revolution/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                          # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ (pages)/                 # Main pages
β”‚   β”‚   β”‚   β”œβ”€β”€ about/               # About page
β”‚   β”‚   β”‚   β”œβ”€β”€ shop/                # Shop pages
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ product/         # Product detail pages
β”‚   β”‚   β”‚   β”‚   └── cart/            # Shopping cart
β”‚   β”‚   β”‚   β”œβ”€β”€ donate/              # Donation pages
β”‚   β”‚   β”‚   β”œβ”€β”€ partners/            # Partnership pages
β”‚   β”‚   β”‚   β”œβ”€β”€ profile/             # User profile
β”‚   β”‚   β”‚   β”œβ”€β”€ orders/              # Order history
β”‚   β”‚   β”‚   β”œβ”€β”€ share/               # Social sharing
β”‚   β”‚   β”‚   └── api/                 # API routes
β”‚   β”‚   β”‚       β”œβ”€β”€ webhooks/        # Webhook handlers
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ stripe/      # Stripe webhooks
β”‚   β”‚   β”‚       β”‚   └── printful/    # Printful webhooks
β”‚   β”‚   β”‚       └── auth/            # Authentication
β”‚   β”‚   β”œβ”€β”€ globals.css              # Global styles
β”‚   β”‚   └── layout.tsx               # Root layout
β”‚   β”œβ”€β”€ components/                  # React components
β”‚   β”‚   β”œβ”€β”€ ui/                      # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ forms/                   # Form components
β”‚   β”‚   β”œβ”€β”€ pages/                   # Page-specific components
β”‚   β”‚   └── layout/                  # Layout components
β”‚   β”œβ”€β”€ contexts/                    # React contexts
β”‚   β”‚   β”œβ”€β”€ ShopContext.tsx          # Shopping context
β”‚   β”‚   └── ProductContext.tsx       # Product context
β”‚   β”œβ”€β”€ lib/                         # Utility libraries
β”‚   β”‚   β”œβ”€β”€ actions.ts               # Server actions
β”‚   β”‚   β”œβ”€β”€ prisma.ts                # Database client
β”‚   β”‚   β”œβ”€β”€ stripe.ts                # Stripe client
β”‚   β”‚   β”œβ”€β”€ resend.ts                # Email client
β”‚   β”‚   β”œβ”€β”€ utils.ts                 # Utility functions
β”‚   β”‚   └── rateLimiter.ts           # Rate limiting
β”‚   β”œβ”€β”€ emails/                      # Email templates
β”‚   β”‚   β”œβ”€β”€ OrderEmails.ts           # Order notifications
β”‚   β”‚   β”œβ”€β”€ DonationEmails.ts        # Donation emails
β”‚   β”‚   └── PartnersTicketEmail.tsx  # Partnership emails
β”‚   β”œβ”€β”€ constants/                   # Static data
β”‚   β”‚   └── index.tsx                # All constants
β”‚   └── hooks/                       # Custom React hooks
β”‚       └── useClickOutside.ts       # Click outside detection
β”œβ”€β”€ prisma/                          # Database schema
β”‚   β”œβ”€β”€ schema.prisma                # Prisma schema
β”‚   └── generated/                   # Generated Prisma client
β”œβ”€β”€ public/                          # Static assets
β”‚   β”œβ”€β”€ Assets/                      # Images and logos
β”‚   └── videos/                      # Video files
β”œβ”€β”€ .env.example                     # Environment variables template
β”œβ”€β”€ .gitignore                       # Git ignore rules
β”œβ”€β”€ next.config.js                   # Next.js configuration
β”œβ”€β”€ package.json                     # Dependencies
β”œβ”€β”€ tailwind.config.js               # Tailwind CSS configuration
└── tsconfig.json                    # TypeScript configuration

πŸ› οΈ Tech Stack

Frontend

  • Next.js 15 - React framework with App Router
  • TypeScript - Type-safe JavaScript
  • Tailwind CSS - Utility-first CSS framework
  • Lucide React - Icon library
  • GSAP - Animation library with SplitText
  • React Email - Email template system

Backend

  • Next.js API Routes - Server-side API
  • Prisma - Database ORM
  • MySQL - Database
  • NextAuth.js v5 - Authentication
  • Server Actions - Form handling

External Services

  • Stripe - Payment processing
  • Printful - Product fulfillment
  • Resend - Email delivery
  • Google OAuth - Authentication

Development Tools

  • ESLint - Code linting
  • Prettier - Code formatting
  • TypeScript - Type checking
  • Prisma Studio - Database management

🎨 Key Features

E-Commerce

  • Product Catalog - Dynamic product listings with filtering
  • Shopping Cart - Persistent cart with guest/user support
  • Checkout Process - Secure Stripe integration
  • Order Management - Order tracking and history
  • Inventory Management - Real-time stock checking

User Experience

  • Responsive Design - Mobile-first approach
  • Dark Theme - Modern aesthetic with gradients
  • Animations - GSAP-powered smooth transitions
  • Accessibility - WCAG compliant design
  • Performance - Optimized loading and caching

Content Management

  • Dynamic Content - Data-driven page generation
  • Image Carousels - Interactive product galleries
  • Form Handling - Contact and partnership forms
  • Email Templates - Professional email communications

Business Features

  • Donation System - One-time and recurring donations
  • Partnership Program - Organization collaboration
  • Social Sharing - Community engagement tools
  • Analytics - User behavior tracking

πŸ”§ Configuration

Database Schema

The application uses Prisma with MySQL. Key models include:

  • User - User accounts and authentication
  • Product - Product catalog and variants
  • Cart/CartItem - Shopping cart functionality
  • Order/OrderItem - Order management
  • Donation - Donation tracking
  • Subscription - Recurring donations
  • PartnerTicket - Partnership inquiries

Environment Variables

All sensitive configuration is managed through environment variables. See .env.example for required variables.

Rate Limiting

Built-in rate limiting prevents API abuse and ensures fair usage across all endpoints.

πŸ“§ Email System

Templates

  • Order Confirmation - Purchase confirmations
  • Shipping Notifications - Order tracking updates
  • Donation Receipts - Tax-deductible receipts
  • Partnership Responses - Collaboration confirmations

Delivery

  • Resend Integration - Reliable email delivery
  • Template Management - React-based email templates
  • Responsive Design - Mobile-friendly emails

πŸš€ Deployment

Vercel (Recommended)

  1. Connect your GitHub repository to Vercel
  2. Configure environment variables in Vercel dashboard
  3. Deploy automatically on push to main branch

Other Platforms

  • Railway - Full-stack deployment
  • DigitalOcean - VPS deployment
  • AWS - Enterprise deployment

πŸ” Code Quality & CI/CD

Pre-commit Workflow

Before committing your changes, run the following checks to ensure code quality:

# Run all checks (lint, format check, type check)
npm run check

# Or run individually:
npm run lint          # Check for linting errors
npm run format:check  # Check code formatting
npm run type-check    # Check TypeScript types

Available Scripts

  • npm run dev - Start development server with Turbopack
  • npm run build - Build for production
  • npm run start - Start production server
  • npm run lint - Run ESLint
  • npm run lint:fix - Fix auto-fixable ESLint issues
  • npm run format - Format code with Prettier
  • npm run format:check - Check code formatting
  • npm run type-check - Run TypeScript type checking
  • npm run check - Run all checks (lint + format + type-check)

Automated CI/CD

GitHub Actions automatically runs quality checks on every push and pull request:

  1. ESLint - Checks for code quality and best practices
  2. Prettier - Verifies code formatting consistency
  3. TypeScript - Validates type safety

The CI pipeline runs on:

  • Push to main or develop branches
  • Pull requests targeting main or develop branches

Note: You don't need to manually configure GitHub Actions - the workflow file (.github/workflows/ci.yml) is already set up and will run automatically when you push to GitHub.

Fixing Issues

If CI fails, fix the issues locally:

# Fix linting issues
npm run lint:fix

# Fix formatting issues
npm run format

# Check types (fix any TypeScript errors in your code)
npm run type-check

🀝 Contributing

We welcome contributions to Digital Revolution! Please see our contributing guidelines:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run quality checks before committing:
    npm run check
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to your branch (git push origin feature/amazing-feature)
  7. Open a pull request

Important: All pull requests must pass the CI checks (linting, formatting, and type checking) before they can be merged.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Printful - Product fulfillment services
  • Stripe - Payment processing
  • Vercel - Hosting and deployment
  • Next.js Team - Amazing React framework
  • Tailwind CSS - Beautiful utility-first CSS

πŸ“ž Contact


Made with ❀️ for digital equity

About

A foundation to expand STEM education and technology to underserved communities.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors