owencooke / what-to-code

An LLM-powered web app to help developers brainstorm and kickstart new software projects!
https://what-to-code.dev
4 stars 0 forks source link
langchain nextjs shadcn-ui supabase

what to code

Screenshot (739)

Installation

Prerequisites

Install pnpm for faster dependency management

npm install --global pnpm

Install all Node modules

pnpm i

See .env.dev for the necessary environment variable template.

Running

pnpm dev

Dev Documentation

Project Structure

scripts/
├── github_templates                # Python scripts for scraping/embedding GitHub template repos for matching
src/
├── app/
│   └── api/                        # API: Backend routes (keep as simple as possible, just define route. Define DB/GitHub/other logic under `src/lib`)
│   │   └── templates/
│   │       └── route.ts
│   └── page.tsx                    # Non-API folders: React routes, to be rendered at specific route according to dir path
├── components/
│   └── ui/                         # ShadCN components automatically added under here using CLI (don't usually need to edit)
│   │   └── shadcn-component.tsx  
│   │
│   └── our-custom-component.tsx    # Custom reusable React components for our app
├── lib/
│   ├── db/                         # Keep DB/query logic here (ex: creating a new Project)
│   │   ├── config.ts
│   │   ├── schema.ts                   # Source of truth for project's DB tables (via Drizzle models)
│   │   └── query/                  
│   │       └── project.ts          
│   ├── github/                     # Keep GitHub API integration calls here (ex: creating repos, issues, etc.)
│   │   └── user.ts                 
│   └── llm/                        # LLM configs (ex: OpenAI, Google) and helper functions (ex: structured JSON output from prompts)
│       ├── config.ts               
│       └── utils.ts               
├── types/                          # TypeScript type definitions and Zod schemas (ex: Idea, Project, ...)
    └── index.ts                    

Managing DB via Drizzle and Supabase

The source of truth for the project's DB schema is defined using Drizzle in src/lib/db/schema.ts.

Updates to the DB schema can be made by modifying the TS definitions in this file and running the following commands:

npx drizzle-kit generate
npx drizzle-kit migrate

See Drizzle docs for more info about schema migration.

Important Notes: