Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 151 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Editron is a browser-based development environment built with Next.js, WebContai
[![Prisma](https://img.shields.io/badge/Prisma-MongoDB-2d3748?logo=prisma)](https://www.prisma.io/)

> [!NOTE]
> Editron is being maintained as an open-source project. Contributor-friendly docs, issue templates, PR templates, and repository checks are included so first-time and returning contributors can work with a predictable workflow.
> Editron is being maintained as an open-source project. Contributor-friendly docs, CI, and contribution automation are included so first-time and returning contributors can work with a predictable workflow.

## What Editron Does

Expand Down Expand Up @@ -79,6 +79,142 @@ The current Prisma schema centers around:
- The collaboration server runs from `server/collab.ts`.
- Yjs document sync is handled between the editor layer and the WebSocket server.

## Project Structure

This project structure follows a modular architecture with separate directories for routes,
components, utilities, APIs, and testing.

<details>
<summary>πŸ“‚ View Complete Project Structure</summary>

```txt
Editron/
β”œβ”€β”€ .github/ # CI workflows, issue & PR templates
β”œβ”€β”€ app/ # Next.js App Router
β”‚ β”œβ”€β”€ (auth)/ # Authenticated route group
β”‚ β”‚ └── auth/
β”‚ β”‚ β”œβ”€β”€ components/ # Auth-specific UI components
β”‚ β”‚ β”œβ”€β”€ layout.tsx
β”‚ β”‚ └── sign-in/
β”‚ β”‚ └── page.tsx
β”‚ β”œβ”€β”€ (root)/ # Public route group
β”‚ β”‚ β”œβ”€β”€ docs/
β”‚ β”‚ β”‚ β”œβ”€β”€ layout.tsx
β”‚ β”‚ β”‚ └── page.tsx
β”‚ β”‚ β”œβ”€β”€ privacy/
β”‚ β”‚ β”‚ └── page.tsx
β”‚ β”‚ β”œβ”€β”€ templates/
β”‚ β”‚ β”‚ β”œβ”€β”€ layout.tsx
β”‚ β”‚ β”‚ └── page.tsx
β”‚ β”‚ β”œβ”€β”€ terms/
β”‚ β”‚ β”‚ └── page.tsx
β”‚ β”‚ β”œβ”€β”€ layout.tsx
β”‚ β”‚ └── page.tsx # Home page
β”‚ β”œβ”€β”€ api/
β”‚ β”‚ β”œβ”€β”€ auth/[...nextauth]/route.ts
β”‚ β”‚ β”œβ”€β”€ chat/
β”‚ β”‚ β”‚ β”œβ”€β”€ route.ts # Streaming AI chat endpoint
β”‚ β”‚ β”‚ β”œβ”€β”€ tools.ts # Tool definitions for AI
β”‚ β”‚ β”‚ └── chat.test.ts
β”‚ β”‚ β”œβ”€β”€ collab-token/[id]/route.ts
β”‚ β”‚ β”œβ”€β”€ completion/route.ts # Code completion endpoint
β”‚ β”‚ β”œβ”€β”€ delete-account/route.ts
β”‚ β”‚ β”œβ”€β”€ deploy/
β”‚ β”‚ β”‚ β”œβ”€β”€ cloudflare/route.ts
β”‚ β”‚ β”‚ β”œβ”€β”€ netlify/route.ts
β”‚ β”‚ β”‚ └── vercel/route.ts
β”‚ β”‚ β”œβ”€β”€ projects/[id]/download/route.ts
β”‚ β”‚ β”œβ”€β”€ template/[id]/route.ts
β”‚ β”‚ β”œβ”€β”€ templates/meta/route.ts
β”‚ β”‚ └── upload-zip/route.ts
β”‚ β”œβ”€β”€ dashboard/
β”‚ β”‚ β”œβ”€β”€ layout.tsx
β”‚ β”‚ └── page.tsx
β”‚ β”œβ”€β”€ playground/[id]/
β”‚ β”‚ └── page.tsx # Main editor shell
β”‚ β”œβ”€β”€ preview/
β”‚ β”‚ └── page.tsx # Sandbox preview route
β”‚ β”œβ”€β”€ error.tsx
β”‚ β”œβ”€β”€ icon.tsx
β”‚ β”œβ”€β”€ layout.tsx
β”‚ └── page.tsx
β”œβ”€β”€ components/
β”‚ β”œβ”€β”€ marketing/ # Landing page components
β”‚ β”‚ β”œβ”€β”€ home-page-client.tsx
β”‚ β”‚ β”œβ”€β”€ template-card.tsx
β”‚ β”‚ └── template-grid.tsx
β”‚ β”œβ”€β”€ providers/ # React context providers
β”‚ β”‚ β”œβ”€β”€ query-provider.tsx
β”‚ β”‚ └── theme-providers.tsx
β”‚ └── ui/ # shadcn/ui primitives and custom components
β”œβ”€β”€ lib/
β”‚ β”œβ”€β”€ constants/
β”‚ β”‚ β”œβ”€β”€ config.ts
β”‚ β”‚ β”œβ”€β”€ template-summaries.ts
β”‚ β”‚ └── templates.ts # Starter template registry
β”‚ β”œβ”€β”€ templates/
β”‚ β”‚ β”œβ”€β”€ actions.ts
β”‚ β”‚ β”œβ”€β”€ actions.test.ts
β”‚ β”‚ └── types.ts
β”‚ β”œβ”€β”€ api-utils.ts # HTTP client helpers
β”‚ β”œβ”€β”€ collab-token.ts # Collaboration token utilities
β”‚ β”œβ”€β”€ db.ts # Prisma client singleton
β”‚ β”œβ”€β”€ playground-auth.ts # Playground access control
β”‚ β”œβ”€β”€ template.ts # Template mapping and processing
β”‚ β”œβ”€β”€ user-data.ts # User data helpers
β”‚ β”œβ”€β”€ utils.ts # General utilities
β”‚ └── yjs.ts # Yjs document helpers
β”œβ”€β”€ modules/
β”‚ β”œβ”€β”€ auth/
β”‚ β”‚ β”œβ”€β”€ actions/
β”‚ β”‚ β”œβ”€β”€ components/
β”‚ β”‚ β”œβ”€β”€ hooks/
β”‚ β”‚ └── types.ts
β”‚ β”œβ”€β”€ dashboard/
β”‚ β”‚ β”œβ”€β”€ actions/
β”‚ β”‚ β”œβ”€β”€ components/
β”‚ β”‚ └── types.ts
β”‚ β”œβ”€β”€ home/ # Home page sections and components
β”‚ β”œβ”€β”€ playground/
β”‚ β”‚ β”œβ”€β”€ components/
β”‚ β”‚ β”œβ”€β”€ hooks/
β”‚ β”‚ └── lib/
β”‚ β”‚ β”œβ”€β”€ editor-config.ts
β”‚ β”‚ β”œβ”€β”€ index.ts
β”‚ β”‚ └── path-to-json.ts
β”‚ β”œβ”€β”€ profile/
β”‚ β”‚ β”œβ”€β”€ actions.ts
β”‚ β”‚ β”œβ”€β”€ components/
β”‚ β”‚ └── data/
β”‚ └── webcontainers/
β”‚ β”œβ”€β”€ components/
β”‚ └── hooks/
β”œβ”€β”€ server/
β”‚ └── collab.ts # Standalone Yjs/WebSocket collaboration server
β”œβ”€β”€ editron-starters/ # Bundled starter templates
β”‚ β”œβ”€β”€ frontend/
β”‚ β”œβ”€β”€ full-stack/
β”‚ β”œβ”€β”€ backend/
β”‚ └── tooling/
β”œβ”€β”€ prisma/
β”‚ └── schema.prisma
β”œβ”€β”€ public/
β”œβ”€β”€ tests/
β”‚ β”œβ”€β”€ __mocks__/
β”‚ β”œβ”€β”€ smoke/
β”‚ β”œβ”€β”€ collab-token.test.ts
β”‚ β”œβ”€β”€ env-manager.test.tsx
β”‚ └── setup.ts
β”œβ”€β”€ types/
β”‚ β”œβ”€β”€ next-auth.d.ts
β”‚ └── y-websocket.d.ts
β”œβ”€β”€ .env.example
β”œβ”€β”€ next.config.ts
└── package.json
```

</details>

## Local Development

### Prerequisites
Expand Down Expand Up @@ -205,13 +341,21 @@ If you deploy collaboration separately from the web app, make sure:

## Where New Contributors Usually Start

Good first areas to understand:
Use this as a route map before digging into individual files:

- `app/`: Next.js routes, API endpoints, layouts, and pages
- `modules/playground/`: editor UI, file tree, AI chat, and workspace behavior
- `modules/webcontainers/`: browser runtime and project execution
- `lib/constants/templates.ts` and `editron-starters/`: starter catalog and template mapping
- `server/collab.ts`: standalone Yjs/WebSocket collaboration server

Start here if you want to work on:

- `app/playground/[id]/page.tsx` for the editor shell
- `modules/playground/` for file editing, AI, and workspace logic
- `modules/webcontainers/` for browser runtime behavior
- `app/api/chat/route.ts` for AI orchestration
- `lib/template.ts` and `lib/constants/templates.ts` for starter-template mapping
- Editor UI: `app/playground/[id]/page.tsx`, `modules/playground/`
- Starter templates: `editron-starters/`, `lib/constants/templates.ts`, `lib/template.ts`
- AI chat and completion: `app/api/chat/route.ts`, `app/api/completion/route.ts`
- Auth and dashboard flows: `modules/auth/`, `modules/dashboard/`
- Collaboration: `server/collab.ts`, `lib/yjs.ts`

For contributor workflow, standards, and pull request expectations, read [CONTRIBUTING.md](./CONTRIBUTING.md). For security reporting, read [SECURITY.md](./SECURITY.md).

Expand Down