Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/owencooke/what-to-code
An LLM-powered web app to help developers brainstorm and kickstart new software projects!
https://github.com/owencooke/what-to-code
langchain nextjs shadcn-ui supabase
Last synced: 2 months ago
JSON representation
An LLM-powered web app to help developers brainstorm and kickstart new software projects!
- Host: GitHub
- URL: https://github.com/owencooke/what-to-code
- Owner: owencooke
- Created: 2024-05-31T03:42:45.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-11-24T05:09:35.000Z (3 months ago)
- Last Synced: 2024-11-24T05:19:10.903Z (3 months ago)
- Topics: langchain, nextjs, shadcn-ui, supabase
- Language: TypeScript
- Homepage: https://what-to-code.dev
- Size: 9.49 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# [what to code](https://www.what-to-code.dev/)
![Screenshot (739)](https://github.com/user-attachments/assets/54a9a7e9-4bfa-4e69-b223-ea1b42894736)## Installation
### Prerequisites
- Node.js v20.17.0
- NPMInstall pnpm for faster dependency management
```bash
npm install --global pnpm
```Install all Node modules
```bash
pnpm i
```See `.env.dev` for the necessary environment variable template.
### Running
```bash
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:
```bash
npx drizzle-kit generate
npx drizzle-kit migrate
```
See [Drizzle docs](https://orm.drizzle.team/docs/migrations#:~:text=email%60%20TEXT%20UNIQUE%3B-,Option%203,-I%20want%20to) for more info about schema migration.**Important Notes:**
- Do **NOT** update the tables directly in Supabase. There is a known bug with Drizzle that can cause errors when trying to sync the schemas if Supabase manages the tables, foreign keys, etc.
- For proper foreign key relationships to be applied, make sure to define them using the `relations` TS function, not just in the TS table definition:
```typescript
// Define the relations
export const projectRelations = relations(projects, ({ one }) => ({
owner: one(users, {
fields: [projects.owner_id],
references: [users.id],
}),
}));
```