Skip to content
Nirmit2103Public

About

Resources

Contributing

Stars

8 stars

Watchers

1 watching

Forks

Latest commit

ย 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

CodeArena ๐Ÿ†

A modern competitive programming platform where developers can showcase their coding skills, track their progress across multiple platforms, connect with teammates, and participate in tournaments.

Live Demo

CodeArena TypeScript Vite Supabase

โœจ Features

  • ๐ŸŽฏ Multi-Platform Integration: Track your stats from LeetCode and HackerRank
  • ๐Ÿ“Š Performance Analytics: Visualize your coding progress with interactive graphs
  • ๐Ÿ‘ฅ Social Features: Connect with friends, send friend requests, and find teammates
  • ๐Ÿ… Leaderboards: Compete with others and climb the rankings
  • ๐ŸŽฎ Tournaments: Participate in coding competitions
  • ๐Ÿ’ผ Project Showcase: Share your projects and discover others' work
  • ๐ŸŽจ Modern UI: Beautiful, responsive interface built with Tailwind CSS
  • ๐Ÿ”’ Secure Authentication: Powered by Supabase Auth

๐Ÿš€ Tech Stack

  • Frontend: React 18, TypeScript, Vite
  • Styling: Tailwind CSS
  • State Management: Zustand
  • Backend & Database: Supabase
  • Charts: Recharts
  • Routing: React Router v6
  • HTTP Client: Axios
  • Icons: Lucide React

๐Ÿ“‹ Prerequisites

Before you begin, ensure you have:

  • Node.js (v18 or higher)
  • npm or yarn
  • A Supabase account (free tier works great!)
  • Git

๐Ÿ› ๏ธ Installation & Setup

1. Clone the Repository

git clone <your-repo-url>
cd CodeArena-main

2. Install Dependencies

npm install

3. Set Up Supabase Database

Option A: Create a New Supabase Project

  1. Go to Supabase Dashboard
  2. Click "New Project"
  3. Fill in your project details
  4. Wait for the project to be provisioned (1-2 minutes)

Option B: If Your Database Expired

If your database has expired, you need to either:

  • Restore it from the Supabase dashboard (if available)
  • Or create a new project and run the migrations

Run Database Migrations

  1. In your Supabase project dashboard, go to SQL Editor
  2. Run each migration file in order:
    • supabase/migrations/20250122044859_empty_tooth.sql
    • supabase/migrations/20250122050051_dawn_lantern.sql
    • supabase/migrations/20250122050650_bronze_moon.sql
    • supabase/migrations/20250123120557_wooden_field.sql

Alternatively, if you have Supabase CLI installed:

npx supabase db push

4. Configure Environment Variables

  1. Copy the example environment file:
cp .env.example .env
  1. Get your Supabase credentials:

    • Go to your Supabase project settings
    • Navigate to API section
    • Copy the Project URL and anon/public key
  2. Update your .env file:

VITE_SUPABASE_URL=your-supabase-project-url
VITE_SUPABASE_ANON_KEY=your-supabase-anon-key

5. Run the Development Server

npm run dev

The app will be available at http://localhost:5173

๐ŸŒ Deployment to Vercel

Quick Deploy

  1. Push your code to GitHub:
git add .
git commit -m "Initial commit"
git push origin main
  1. Go to Vercel

  2. Click "Add New Project"

  3. Import your GitHub repository

  4. Configure your project:

    • Framework Preset: Vite
    • Build Command: npm run build
    • Output Directory: dist
  5. Add Environment Variables in Vercel:

    • Go to Settings โ†’ Environment Variables
    • Add VITE_SUPABASE_URL with your Supabase URL
    • Add VITE_SUPABASE_ANON_KEY with your Supabase anon key
  6. Click "Deploy"

Your app will be live in a few minutes! ๐ŸŽ‰

Alternative: Deploy with Vercel CLI

npm i -g vercel
vercel login
vercel

Follow the prompts and add your environment variables when asked.

๐Ÿ“ฑ Alternative Deployment Options

Deploy to Netlify

  1. Go to Netlify
  2. Click "Add new site" โ†’ "Import an existing project"
  3. Connect your GitHub repository
  4. Configure:
    • Build command: npm run build
    • Publish directory: dist
  5. Add environment variables in Site Settings
  6. Deploy!

Deploy to GitHub Pages

  1. Install gh-pages:
npm install --save-dev gh-pages
  1. Add to package.json:
"homepage": "https://your-username.github.io/CodeArena",
"scripts": {
  "predeploy": "npm run build",
  "deploy": "gh-pages -d dist"
}
  1. Update vite.config.ts:
export default defineConfig({
  base: '/CodeArena/',
  // ... rest of config
})
  1. Deploy:
npm run deploy

๐Ÿ”ง Database Schema

The project uses the following main tables:

  • profiles: User profiles and information
  • friend_requests: Friend connection system
  • projects: User project showcases
  • tournaments: Competitive coding events
  • Additional tables: Check migration files for complete schema

๐Ÿ—๏ธ Project Structure

CodeArena-main/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ components/       # React components
โ”‚   โ”œโ”€โ”€ lib/             # API clients and utilities
โ”‚   โ”œโ”€โ”€ store/           # Zustand state management
โ”‚   โ”œโ”€โ”€ types/           # TypeScript type definitions
โ”‚   โ””โ”€โ”€ constants/       # App constants
โ”œโ”€โ”€ supabase/
โ”‚   โ””โ”€โ”€ migrations/      # Database migrations
โ”œโ”€โ”€ public/              # Static assets
โ””โ”€โ”€ ... config files

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“ Available Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run preview - Preview production build
  • npm run lint - Run ESLint

๐Ÿ› Troubleshooting

Database Connection Issues

If you see "Invalid API key" or connection errors:

  1. Verify your .env file has the correct Supabase credentials
  2. Check if your Supabase project is active (not paused/expired)
  3. Ensure you've run all database migrations

Build Errors

If you encounter build errors:

  1. Delete node_modules and reinstall: rm -rf node_modules && npm install
  2. Clear cache: npm run build -- --force
  3. Check that all environment variables are set

Deployment Issues

  • Make sure environment variables are set in your deployment platform
  • Verify the build command and output directory are correct
  • Check deployment logs for specific errors

๐Ÿ“„ License

This project is open source and available under the MIT License.

๐Ÿ™ Acknowledgments


Note: Remember to keep your .env file private and never commit it to GitHub! Always use .env.example as a template for others.

For more help, feel free to open an issue or reach out!

Happy Coding! ๐Ÿ’ปโœจ

About

Resources

Contributing

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages