RhysSullivan/create-epoch-app

★ 106Forks 5TypeScriptGitHub ↗Compare

README

create-epoch-app

An opinionated starter template for building full-stack applications with Effect, Convex, and Next.js.

e - effect

p - posthog

o - otel

c - convex

h - help me find something with h to cram in here

What's Included

Apps

  • apps/main-site - Next.js 15 app with App Router, Tailwind CSS, and shadcn/ui components
  • apps/discord-bot - Discord bot built with Effect and Reacord (React for Discord)

Packages

  • packages/confect - Effect + Convex integration layer with type-safe schemas and handlers
  • packages/database - Convex backend with Better Auth integration
  • packages/ui - Shared React components built on Radix UI and Tailwind
  • packages/reacord - React renderer for Discord embeds and interactions
  • packages/observability - Sentry and OpenTelemetry integration for Effect
  • packages/convex-test - Testing utilities for Convex functions

Tech Stack

Getting Started

Prerequisites

Setup

  1. Clone the repository:
git clone https://github.com/your-username/create-epoch-app.git
cd create-epoch-app
  1. Install dependencies:
bun install
  1. Copy the environment file and configure it:
cp .env.example .env
  1. Set up Convex:
cd packages/database
bunx convex dev
  1. Start development:
bun dev

This starts:

Project Structure

├── apps/
│   ├── discord-bot/     # Discord bot with Effect + Reacord
│   └── main-site/       # Next.js frontend
├── packages/
│   ├── confect/         # Effect + Convex integration
│   ├── convex-test/     # Convex testing utilities
│   ├── database/        # Convex backend + auth
│   ├── observability/   # Sentry + OpenTelemetry
│   ├── reacord/         # React for Discord
│   └── ui/              # Shared UI components
└── scripts/             # Build and setup scripts

Key Patterns

Effect + Convex (Confect RPC)

The confect package provides type-safe Convex RPC functions with Effect:

import { createRpcFactory, makeRpcModule } from "@packages/confect/rpc";
import { Effect, Schema } from "effect";
import { ConfectMutationCtx, confectSchema } from "../confect";

const factory = createRpcFactory({ schema: confectSchema });

export const postsModule = makeRpcModule({
  create: factory.mutation(
    { payload: { title: Schema.String }, success: Schema.String },
    (args) =>
      Effect.gen(function* () {
        const ctx = yield* ConfectMutationCtx;
        const id = yield* ctx.db.insert("posts", { title: args.title });
        return id;
      }),
  ),
});

Discord Bot with Reacord

Build Discord UIs with React components:

import { Button, Container } from "@packages/reacord";

function WelcomeMessage({ username }: { username: string }) {
  return (
    <Container>
      <h1>Welcome, {username}!</h1>
      <Button label="Get Started" onClick={() => console.log("clicked")} />
    </Container>
  );
}

Better Auth Integration

Authentication is pre-configured with Better Auth for Convex:

import { useSession } from "@packages/ui/components/convex-client-provider";

function Profile() {
  const { data: session } = useSession();
  if (!session) return <SignInButton />;
  return <div>Hello, {session.user.name}</div>;
}

Scripts

bun dev          # Start all apps in development
bun build        # Build all packages
bun typecheck    # Type check all packages
bun test         # Run tests
bun lint         # Lint with Biome
bun lint:fix     # Fix lint issues

License

FSL-1.1-MIT - Functional Source License with MIT future license.

Contributors

RhysSullivan

Issues