Skip to content

🟠 Code.Hub is a platform that allows users to share, execute and comment their own coding snippets built with Next-15

Notifications You must be signed in to change notification settings

nikcladis/code-hub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Code Hub (SaaS) πŸš€πŸ’»

Code snippet manager. This project demonstrates user's ability to share, execute, and comment on code snippets in various programming languages.


Tech Stack πŸ› οΈ

  • Frontend: Next.js 15 βš›οΈ
  • Authentication: Clerk πŸ”‘ (Google 🌐 and GitHub πŸ™ authentication)
  • Database: Convex πŸ“¦

Key Features ✨

  • Authentication:
    πŸ”‘ Secure login via Google 🌐 and GitHub πŸ™ using Clerk.
  • Code Snippet Management:
    πŸ“„ Create, share, and manage code snippets.
    πŸ’¬ Add comments on snippets.
    ⭐ Star favorite snippets for quick access.
  • Code Execution Logs:
    πŸ–₯️ Store and view details of executed code.
  • User Management:
    🌟 Pro user support with LemonSqueezy integration for subscriptions.

Convex Database Schema πŸ—„οΈ

The database is structured using Convex for real-time interactions. Below is the schema definition:

import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";

export default defineSchema({
  codeExecutions: defineTable({
    code: v.string(),
    error: v.optional(v.string()),
    language: v.string(),
    output: v.optional(v.string()),
    userId: v.string(),
  }).index("by_user_id", ["userId"]),
  snippetComments: defineTable({
    content: v.string(),
    snippetId: v.id("snippets"),
    userId: v.string(),
    userName: v.string(),
  }).index("by_snippet_id", ["snippetId"]),
  snippets: defineTable({
    code: v.string(),
    language: v.string(),
    title: v.string(),
    userId: v.string(),
    userName: v.string(),
  }).index("by_user_id", ["userId"]),
  stars: defineTable({
    snippetId: v.id("snippets"),
    userId: v.string(),
  })
    .index("by_snippet_id", ["snippetId"])
    .index("by_user_id", ["userId"])
    .index("by_user_id_and_snippet_id", [
      "userId",
      "snippetId",
    ]),
  users: defineTable({
    email: v.string(),
    isPro: v.boolean(),
    lemonSqueezyId: v.optional(v.string()),
    lemonSqueezyOrderId: v.optional(v.string()),
    name: v.string(),
    proSince: v.optional(v.float64()),
    userId: v.string(),
  }).index("by_user_id", ["userId"]),
});

Getting Started 🏁

Prerequisites βœ…

  • Node.js (v16 or higher) 🟒
  • npm or yarn πŸ“¦
  • Convex CLI πŸ”§
  • Clerk API keys πŸ”‘

Installation πŸ“₯

  1. Clone the repository:

    git clone https://github.com/yourusername/code-hub-saas.git
  2. Navigate to the project directory:

    cd code-hub-saas
  3. Install dependencies:

    npm install
  4. Setup βš™οΈ

    Create a .env file and add your Clerk and Convex credentials:

    NEXT_PUBLIC_CLERK_FRONTEND_API=<your-clerk-api>
    CONVEX_URL=<your-convex-url>
  5. Run the Convex schema:

    npx convex dev
  6. Start the development server:

    npm run dev
  7. Access the application at:

    http://localhost:3000
    

Usage πŸ“˜

  • Sign In: Log in using your Google 🌐 or GitHub πŸ™ account.
  • Create Snippets: Add code snippets with a title, language, and optional description.
  • Collaborate: Add comments πŸ’¬ and discuss snippets with other users.
  • Pro Features: Unlock advanced features 🌟 by upgrading to Pro via LemonSqueezy.

About

🟠 Code.Hub is a platform that allows users to share, execute and comment their own coding snippets built with Next-15

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published