-
Notifications
You must be signed in to change notification settings - Fork 0
Implement Todo management features and enhance dashboard application #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ahargunyllib
wants to merge
48
commits into
main
Choose a base branch
from
feat/todo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
2a3b4a3
feat: Implement Nano ID generation utilities with createNanoId and cr…
ahargunyllib 61be1ad
feat: Add initial database setup with todo schema and queries
ahargunyllib aed4080
feat: Implement core package with Todo service, types, and configuration
ahargunyllib 7679995
feat: Enhance API with TRPC integration, Todo service, and database s…
ahargunyllib 00fe3bf
chore: update dependencies in pnpm-workspace.yaml
ahargunyllib 2665879
feat: Update worker configuration to use dynamic name and conditional…
ahargunyllib af9b16a
feat: Add react.json configuration for TypeScript with JSX support
ahargunyllib ab1b2cf
feat(dashboard): initialize dashboard application with routing and de…
ahargunyllib 1101a89
feat: Update TypeScript configuration to include ESNext library support
ahargunyllib 3f02b49
feat: add UI components and utilities
ahargunyllib 2f1f15a
feat: update package dependencies and integrate TooltipProvider in ma…
ahargunyllib 7c32703
chore: update pnpm workspace dependencies and add Tailwind CSS support
ahargunyllib c8329c7
feat: add typecheck script to package.json files across multiple pack…
ahargunyllib 1db9f24
feat: add robots.txt to restrict web crawler access
ahargunyllib ea6a5dd
feat: implement ThemeProvider component and update theme handling in …
ahargunyllib cb814c5
feat: update API to use @hono/trpc-server and refine CORS settings
ahargunyllib 9eab011
feat: remove description field from createTodo and updateTodo procedures
ahargunyllib 683df83
feat: export TRPCRouter type alongside trpcRouter from routers
ahargunyllib f7450cb
feat: refactor context to create database instance before todo queries
ahargunyllib 9d6573d
feat: implement todo management features with create, delete, and tog…
ahargunyllib ff24e42
fix: update zod version specification in pnpm-lock and pnpm-workspace…
ahargunyllib 62fdc2c
feat: enhance todo toggle functionality with error handling and query…
ahargunyllib 7a2e274
feat: implement error handling in todo service and add AppError class…
ahargunyllib c85c665
feat: add logger package with Logger class and type definitions
ahargunyllib 41c804d
feat: integrate logger into context and TRPC procedures for enhanced …
ahargunyllib 7df587f
feat: add logger integration and request ID generation in TRPC context
ahargunyllib 91de69c
feat: add logger and utils package links in pnpm-lock.yaml
ahargunyllib f7ef021
feat: update TypeScript configuration by refining base.json and remov…
ahargunyllib 60d44b9
feat: update TypeScript configuration for logger package to use ES202…
ahargunyllib 1410b20
feat: update database name to include application stage in alchemy.ru…
ahargunyllib bcdfee9
feat: add GitHub Actions workflow for dashboard deployment and cleanup
ahargunyllib 6b2e7c8
feat: remove requestId from logging context in TRPC baseProcedure
ahargunyllib b149c76
feat: update CORS configuration to allow multiple origins
ahargunyllib e781f0a
feat: add @realm/utils dependency and refactor useIsCompleteToggle to…
ahargunyllib c04155e
feat: add @realm/types package with Todo type and update imports in core
ahargunyllib c923b3b
feat: add @realm/kv package with KV and Todo operations, including ty…
ahargunyllib ced3acf
feat: add TODO comment for improving CORS handling in the future
ahargunyllib 7fd839c
feat: implement todo key management and enhance TodoOperations with g…
ahargunyllib c9a80ea
feat: update updateTodo method to return SelectTodo or null on failure
ahargunyllib 451fbb4
feat: add BaseContext type definition for context management
ahargunyllib 976224c
feat: enhance BaseContext type definition with detailed waitUntil doc…
ahargunyllib 6035bf4
feat: refactor TodoService to integrate TodoOperations and enhance ge…
ahargunyllib 626aae9
feat: enhance context management by integrating KVNamespaceType and a…
ahargunyllib 5c7e40e
feat: integrate KVNamespace for enhanced state management in alchemy.…
ahargunyllib 196fa79
feat: add '@realm/kv' dependency and update related package versions …
ahargunyllib dd9c569
feat: improve KVSetOptions documentation and remove default expiratio…
ahargunyllib 86cdfa7
feat: update getAllTodo return type to allow null values
ahargunyllib 15e8c39
feat: update concurrency group names in deployment workflows for cons…
ahargunyllib File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| name: Dashboard Deployment | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, closed] | ||
| branches: | ||
| - main | ||
| paths: | ||
| - "apps/dashboard/**" | ||
| - "packages/**" | ||
| - "package.json" | ||
| - "pnpm-lock.yaml" | ||
| - "!**/*.md" | ||
| - "!**/README*" | ||
|
|
||
| concurrency: | ||
| group: dashboard-${{ github.event.pull_request.number }}-${{ github.sha }} | ||
| cancel-in-progress: false | ||
|
|
||
| env: | ||
| STAGE: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || (github.ref == 'refs/heads/main' && 'prod' || github.ref_name) }} | ||
|
|
||
| jobs: | ||
| deploy: | ||
| if: ${{ github.event.action != 'closed' }} | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 22 | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v5 | ||
| with: | ||
| version: "10.14.0" | ||
|
|
||
| - name: Cache pnpm store | ||
| uses: actions/cache@v5 | ||
| with: | ||
| path: ~/.pnpm-store | ||
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pnpm-store- | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Deploy | ||
| working-directory: apps/dashboard | ||
| run: pnpm dlx alchemy deploy --stage ${{ env.STAGE }} | ||
| env: | ||
| ALCHEMY_PASSWORD: ${{ secrets.ALCHEMY_PASSWORD }} | ||
| ALCHEMY_STATE_TOKEN: ${{ secrets.ALCHEMY_STATE_TOKEN }} | ||
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
| CLOUDFLARE_EMAIL: ${{ secrets.CLOUDFLARE_EMAIL }} | ||
| PULL_REQUEST: ${{ github.event.number }} | ||
| GITHUB_SHA: ${{ github.sha }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| NODE_ENV: production | ||
|
|
||
| cleanup: | ||
| runs-on: ubuntu-latest | ||
| if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' }} | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 22 | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v5 | ||
| with: | ||
| version: "10.14.0" | ||
|
|
||
| - name: Cache pnpm store | ||
| uses: actions/cache@v5 | ||
| with: | ||
| path: ~/.pnpm-store | ||
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pnpm-store- | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Safety Check | ||
| run: |- | ||
| if [ "${{ env.STAGE }}" = "prod" ]; then | ||
| echo "ERROR: Cannot destroy prod environment in cleanup job" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Destroy Preview Environment | ||
| working-directory: apps/dashboard | ||
| run: pnpm dlx alchemy destroy --stage ${{ env.STAGE }} | ||
| env: | ||
| ALCHEMY_PASSWORD: ${{ secrets.ALCHEMY_PASSWORD }} | ||
| ALCHEMY_STATE_TOKEN: ${{ secrets.ALCHEMY_STATE_TOKEN }} | ||
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
| CLOUDFLARE_EMAIL: ${{ secrets.CLOUDFLARE_EMAIL }} | ||
| PULL_REQUEST: ${{ github.event.number }} | ||
| NODE_ENV: production |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -266,3 +266,6 @@ $RECYCLE.BIN/ | |
|
|
||
| # Alchemy | ||
| *.alchemy | ||
|
|
||
| # Tanstack | ||
| *.tanstack | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,68 @@ | ||
| import { trpcServer } from "@hono/trpc-server"; | ||
| import { createContext, trpcRouter } from "@realm/api"; | ||
| import type { D1Database } from "@realm/db"; | ||
| import type { KVNamespaceType } from "@realm/kv"; | ||
| import { createLogger } from "@realm/logger"; | ||
| import { createNanoId } from "@realm/utils"; | ||
| import { Hono } from "hono"; | ||
| import { cors } from "hono/cors"; | ||
| import { logger } from "hono/logger"; | ||
|
|
||
| const app = new Hono(); | ||
| const app = new Hono<{ | ||
| Bindings: { | ||
| DB: D1Database; | ||
| KV: KVNamespaceType; | ||
| }; | ||
| }>(); | ||
|
|
||
| app.use(logger()); | ||
| app.use( | ||
| "/*", | ||
| cors({ | ||
| origin: (origin) => { | ||
| // TODO: This is a temporary solution to allow CORS for localhost and our deployed domains. We should have a better solution for this in the future. | ||
| const allowedOrigins = [ | ||
| "localhost", | ||
| "ahargunyllib.dev", | ||
| "ahargunyllib.workers.dev", | ||
| ]; | ||
| if ( | ||
| allowedOrigins.some((allowedOrigin) => origin.includes(allowedOrigin)) | ||
| ) { | ||
| return origin; | ||
| } | ||
| }, | ||
| allowMethods: ["GET", "POST", "OPTIONS"], | ||
| allowHeaders: ["Content-Type", "Authorization", "trpc-accept"], | ||
| credentials: true, | ||
| }) | ||
| ); | ||
ahargunyllib marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| app.get("/", (c) => c.text("Hello World")); | ||
| app.get("/health", (c) => c.json({ status: "ok" })); | ||
|
|
||
| export default app; | ||
| app.use( | ||
| "/trpc/*", | ||
| trpcServer({ | ||
| router: trpcRouter, | ||
| createContext: (opts, c) => { | ||
| const requestId = createNanoId(); | ||
| const customLogger = createLogger({ requestId }); | ||
|
|
||
| return createContext({ | ||
| env: { | ||
| db: c.env.DB, | ||
| kv: c.env.KV, | ||
| }, | ||
| fetchCreateContextFnOptions: opts, | ||
| logger: customLogger, | ||
| requestId, | ||
| waitUntil: c.executionCtx.waitUntil, | ||
| }); | ||
| }, | ||
| }) | ||
| ); | ||
|
|
||
| export default { | ||
| fetch: app.fetch, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # openssl rand -base64 32 | ||
| ALCHEMY_STATE_TOKEN=your-generated-token-here | ||
| ALCHEMY_PASSWORD=your-generated-password-here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import alchemy from "alchemy"; | ||
| import { Vite } from "alchemy/cloudflare"; | ||
| import { GitHubComment } from "alchemy/github"; | ||
| import { CloudflareStateStore } from "alchemy/state"; | ||
|
|
||
| const app = await alchemy("realm-dashboard", { | ||
| stateStore: | ||
| process.env.NODE_ENV === "production" | ||
| ? (scope) => | ||
| new CloudflareStateStore(scope, { | ||
| scriptName: "realm-api-state-store", | ||
| }) | ||
| : undefined, // Uses default FileSystemStateStore | ||
| password: process.env.ALCHEMY_PASSWORD, | ||
| }); | ||
|
|
||
| const worker = await Vite("dashboard", { | ||
| name: `realm-dashboard-${app.stage}`, | ||
| bindings: { | ||
| VITE_PUBLIC_API_URL: process.env.API_URL || "http://localhost:3000", | ||
| }, | ||
| domains: app.stage === "prod" ? ["dash.ahargunyllib.dev"] : undefined, | ||
| }); | ||
|
|
||
| if (process.env.PULL_REQUEST) { | ||
| // if this is a PR, add a comment to the PR with the preview URL | ||
| // it will auto-update with each push | ||
| await GitHubComment("preview-comment", { | ||
| owner: "ahargunyllib", | ||
| repository: "realm", | ||
| issueNumber: Number(process.env.PULL_REQUEST), | ||
| body: `### Preview Deployment | ||
|
|
||
| **Commit:** \`${process.env.GITHUB_SHA}\` | ||
| **Preview URL:** ${worker.url} | ||
| **Deployed at:** ${new Date().toUTCString()}`, | ||
| }); | ||
| } | ||
|
|
||
| console.log(`Dashboard deployed at: ${worker.url}`); | ||
|
|
||
| await app.finalize(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>Realm Dashboard</title> | ||
| </head> | ||
|
|
||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" async src="/src/main.tsx"></script> | ||
| </body> | ||
| </html> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.