Skip to content

add new form field, improved indexing, update libs and readme#22

Merged
kegren merged 2 commits intomainfrom
add-form-field-indexing-update-libs
Jan 4, 2026
Merged

add new form field, improved indexing, update libs and readme#22
kegren merged 2 commits intomainfrom
add-form-field-indexing-update-libs

Conversation

@kegren
Copy link
Owner

@kegren kegren commented Jan 4, 2026

No description provided.

@greptile-apps
Copy link

greptile-apps bot commented Jan 4, 2026

Greptile Summary

This PR adds a new NumberField form component, improves database query performance with indexes on the todos table, updates dependencies, and rewrites the README with better documentation.

Key changes:

  • Added NumberField component for numeric form inputs with min/max/step validation
  • Added database indexes on todo table for userId, createdAt, and a composite index on userId + completed
  • Updated .env.example with new environment variables for useSend, OAuth providers, and NODE_ENV
  • Rewrote README with Railway deployment instructions and improved project documentation
  • Updated landing page with new tech stack badges and feature highlights
  • Bumped versions of better-auth, react-email, and TanStack packages

Issues found:

  • Environment variable naming mismatch: .env.example defines USESEND_EMAIL_FROM but env.ts expects USESEND_FROM_EMAIL
  • Breaking change: EMAIL_FROM was renamed to USESEND_FROM_EMAIL in env schema, but send-email.ts still references the old env.EMAIL_FROM property

Confidence Score: 2/5

  • This PR has a breaking bug in the email configuration that will cause runtime errors when sending emails.
  • The environment variable renaming introduced inconsistencies: .env.example uses a different name than env.ts, and send-email.ts still references the old property name. This will cause TypeScript errors and runtime failures.
  • src/lib/server/env.ts and .env.example need attention to fix the environment variable naming mismatch.

Important Files Changed

Filename Overview
.env.example Added new environment variables for useSend, OAuth providers, and NODE_ENV. Contains a naming mismatch: USESEND_EMAIL_FROM should be USESEND_FROM_EMAIL to match env.ts.
README.md Complete rewrite with improved documentation, deployment instructions for Railway, and updated project structure.
bun.lock Dependency updates for better-auth, react-email components, tanstack form/query packages.
package.json Standard dependency version bumps.
src/components/form/number-field.tsx New form field component for number inputs with min/max/step support and validation state handling.
src/db/schema/todos.ts Added database indexes for userId, createdAt, and a composite index on userId+completed for better query performance.
src/hooks/form.ts Added NumberField to the form hook's fieldComponents registry.
src/lib/server/env.ts Renamed EMAIL_FROM to USESEND_FROM_EMAIL, made USESEND_API_KEY required, added USESEND_BASE_URL. Breaking: send-email.ts still references old env.EMAIL_FROM.
src/routes/index.tsx Updated landing page with new tech stack badges and feature highlights. UI-only changes.

Sequence Diagram

sequenceDiagram
    participant User
    participant Form
    participant NumberField
    participant Database
    participant EmailService
    
    Note over Form,NumberField: New NumberField Component
    User->>Form: Enter numeric value
    Form->>NumberField: Render with min/max/step
    NumberField->>Form: handleChange(Number(value))
    
    Note over Database: Improved Indexing
    Database->>Database: index(userId)
    Database->>Database: index(createdAt)
    Database->>Database: index(userId, completed)
    
    Note over EmailService: ⚠️ Broken Reference
    EmailService->>EmailService: env.EMAIL_FROM (undefined!)
    EmailService--xUser: Error: Property not found
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

.env.example Outdated
TURNSTILE_SITE_KEY=
TURNSTILE_SECRET_KEY= No newline at end of file
USESEND_BASE_URL=
USESEND_EMAIL_FROM=
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: Environment variable name mismatch: .env.example uses USESEND_EMAIL_FROM but src/lib/server/env.ts expects USESEND_FROM_EMAIL. This will cause the app to fail at startup.

Suggested change
USESEND_EMAIL_FROM=
USESEND_FROM_EMAIL=
Prompt To Fix With AI
This is a comment left during a code review.
Path: .env.example
Line: 7:7

Comment:
**syntax:** Environment variable name mismatch: `.env.example` uses `USESEND_EMAIL_FROM` but `src/lib/server/env.ts` expects `USESEND_FROM_EMAIL`. This will cause the app to fail at startup.

```suggestion
USESEND_FROM_EMAIL=
```

How can I resolve this? If you propose a fix, please make it concise.

EMAIL_FROM: z.email().optional(),
USESEND_API_KEY: z.string(),
USESEND_BASE_URL: z.url().optional(),
USESEND_FROM_EMAIL: z.email(),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: This env variable was renamed from EMAIL_FROM to USESEND_FROM_EMAIL, but src/lib/email/send-email.ts:22 still references env.EMAIL_FROM. This will cause a TypeScript error and runtime failure when sending emails.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/lib/server/env.ts
Line: 10:10

Comment:
**logic:** This env variable was renamed from `EMAIL_FROM` to `USESEND_FROM_EMAIL`, but `src/lib/email/send-email.ts:22` still references `env.EMAIL_FROM`. This will cause a TypeScript error and runtime failure when sending emails.

How can I resolve this? If you propose a fix, please make it concise.

Update .env.example to reflect the corrected environment variable
name used by the application. The old key USESEND_EMAIL_FROM is
renamed to USESEND_FROM_EMAIL to match naming conventions and the
expected configuration consumed by the code. This prevents confusion
and ensures environment setup works as intended.
@kegren kegren merged commit 8a9af26 into main Jan 4, 2026
1 check passed
@kegren kegren deleted the add-form-field-indexing-update-libs branch January 4, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant