{"id":30062516,"url":"https://github.com/ericc-ch/starter-web","last_synced_at":"2025-08-08T03:36:42.958Z","repository":{"id":303700795,"uuid":"1016373346","full_name":"ericc-ch/starter-web","owner":"ericc-ch","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-03T03:14:47.000Z","size":930,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-03T05:25:54.426Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ericc-ch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-08T23:20:25.000Z","updated_at":"2025-08-03T03:14:50.000Z","dependencies_parsed_at":"2025-07-09T01:32:25.795Z","dependency_job_id":"9ddba8bd-a299-4260-89eb-264372ca68ad","html_url":"https://github.com/ericc-ch/starter-web","commit_stats":null,"previous_names":["ericc-ch/starter-web"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ericc-ch/starter-web","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericc-ch%2Fstarter-web","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericc-ch%2Fstarter-web/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericc-ch%2Fstarter-web/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericc-ch%2Fstarter-web/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericc-ch","download_url":"https://codeload.github.com/ericc-ch/starter-web/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericc-ch%2Fstarter-web/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269360651,"owners_count":24404295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-08T03:36:39.910Z","updated_at":"2025-08-08T03:36:42.949Z","avatar_url":"https://github.com/ericc-ch.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## How to Use This Starter Template\n\nThis starter is a full-stack React application using React Router, Hono for the API, Drizzle ORM for the database, and is deployed on Cloudflare Pages.\n\n### Getting Started\n\n1.  **Clone the repository and install dependencies:**\n\n    ```bash\n    git clone \u003cyour-repo-url\u003e\n    cd \u003cyour-repo-name\u003e\n    pnpm install\n    ```\n\n2.  **Set up your Cloudflare D1 Database:**\n\n    The project is configured to use Cloudflare D1. The `wrangler.jsonc` file contains the necessary configuration.\n\n    - To run locally, you don't need to change anything. The development server will use a local version of D1.\n    - For staging and production, you will need to create your own D1 databases in your Cloudflare account and update the `database_id` in `wrangler.jsonc` for those environments.\n\n3.  **Run the development server:**\n\n    ```bash\n    pnpm run dev\n    ```\n\n    This command starts the Vite development server, and your application will be available at `http://localhost:5173`.\n\n### Project Structure\n\n- `src/app`: Contains the React frontend application, with routing handled by React Router.\n- `src/api`: Contains the Hono-based API server.\n- `src/db`: Includes database-related files, such as Drizzle schemas and the database connection setup.\n- `workers`: Contains the Cloudflare Worker entry point.\n\n### Adding a New Page (React Router)\n\n1.  Create a new directory under `src/app/routes`. For example, `src/app/routes/about`.\n\n2.  Inside this new directory, create a `_route.tsx` file. This file will contain your React component.\n\n    ```tsx\n    // src/app/routes/about/_route.tsx\n    export default function AboutPage() {\n      return \u003ch1\u003eAbout Us\u003c/h1\u003e;\n    }\n    ```\n\n3.  Update `src/app/routes.ts` to include your new route.\n\n    ```ts\n    import { type RouteConfig, index, route } from \"@react-router/dev/routes\";\n\n    export default [\n      index(\"./routes/home/_route.tsx\"),\n      route(\"/about\", \"./routes/about/_route.tsx\"), // Add your new route here\n      route(\"/api/*\", \"./routes/_api.tsx\"),\n    ] satisfies RouteConfig;\n    ```\n\n### Adding a New API Endpoint (Hono)\n\nThe API routes are structured by feature under `src/api/routes`.\n\n1.  Create a new folder for your feature, for example, `src/api/routes/users`.\n\n2.  Inside this folder, create the following files:\n\n    - `_route.ts`: Defines the Hono router for this endpoint.\n    - `handler.ts`: Contains the business logic for your route handlers.\n    - `validator.ts` (optional): Contains Zod schemas for validating request data.\n\n3.  Wire up your new route in `src/api/routes/routes.ts`.\n\n    ```ts\n    import { Hono } from \"hono\";\n    import { books } from \"./books/_route\";\n    import { index } from \"./index/_route\";\n    import { users } from \"./users/_route\"; // Import your new route\n\n    export const routes = new Hono()\n      .route(\"/\", index)\n      .route(\"/books\", books)\n      .route(\"/users\", users); // Add your new route\n    ```\n\n### Interacting with the Database (Drizzle ORM)\n\n1.  **Define your schema:** Create or modify a schema file in `src/db/schemas/`. For example, `books.sql.ts` defines the `books` table.\n\n2.  **Generate migrations:** After changing a schema, run the generate command:\n\n    ```bash\n    pnpm run db:generate\n    ```\n\n    This will create a new SQL migration file in the `drizzle` directory.\n\n3.  **Apply migrations:**\n\n    - **Local:**\n      ```bash\n      pnpm run db:migrate:local\n      ```\n    - **Staging/Production:** You'll need to update the `\u003cstaging-db\u003e` placeholder in `package.json` and run the corresponding script.\n\n4.  **Query the database:** You can use the `getDB` function available in `src/db/db.server.ts` within your API handlers to get a Drizzle instance and query your database.\n\n    ```ts\n    // Example from src/api/routes/books/handler.ts\n    import { getDB } from \"~/db/db.server\";\n\n    export const listBooks = async (c: Context\u003cBindings\u003e) =\u003e {\n      const db = getDB(c.env.cloudflare.env.DB);\n      const books = await db.query.books.findMany();\n      return c.json({ books });\n    };\n    ```\n\n### Deployment\n\nThis starter is configured for deployment to **Cloudflare Pages**.\n\n1.  **Build your application:**\n\n    ```bash\n    pnpm run build\n    ```\n\n2.  **Deploy to production:**\n\n    ```bash\n    pnpm run deploy\n    ```\n\n    This command will build your application and deploy it using Wrangler to your configured Cloudflare account.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericc-ch%2Fstarter-web","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericc-ch%2Fstarter-web","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericc-ch%2Fstarter-web/lists"}