Blogly assignment complete - #16
Open
Grenish wants to merge 189 commits into
Open
Conversation
The Neon toolchain writes a .neon directory for local project state. Keeping it out of git prevents machine-specific connection metadata from landing in the repository.
The Blogly assignment needs authentication, a Postgres ORM, and a UI kit. This adds better-auth with the Drizzle 1.0 adapter, drizzle-orm/kit, the Neon serverless driver, and shadcn-related packages so those layers can be wired up next.
package.json now lists Better Auth, Drizzle, Neon, and shadcn packages. Committing the matching lockfile keeps npm ci installs reproducible.
The workspace also has a bun.lock from local Bun installs. Checking it in keeps Bun users on the same dependency graph as the declared packages.
Neon preview branches should not live forever. This config leaves the default branch unchanged and auto-expires new non-default branches after seven days.
Kit was still looking at ./src/db/schema.ts, which does not exist in this app. The config now loads the real schema barrel and prefers DATABASE_URL_UNPOOLED so migrations do not run through PgBouncer.
Better Auth needs user, session, account, and verification tables, including the issuer unique key on accounts. Relations use defineRelations so the schema works with drizzle-orm 1.0 instead of the removed relations() helper.
Drizzle Kit and the app should import tables from one place. This barrel forwards the Better Auth tables, authSchema object, and authRelations so later domain schemas can join the same export.
Better Auth and future queries need a shared db instance. The client uses @neondatabase/serverless over HTTP, fails fast when DATABASE_URL is missing, and registers Drizzle 1.0 relations instead of the old schema option.
The previous auth module imported a missing schema file and used the Drizzle 0.x client API. This wires Better Auth to the shared db through @better-auth/drizzle-adapter/relations-v2 and the generated authSchema, with email and password enabled.
Client components cannot import the server auth instance. createAuthClient() provides the matching browser SDK for session and credential helpers.
shadcn components combine conditional classes with theme tokens. clsx plus tailwind-merge keeps those class strings deterministic and override-friendly.
The Drizzle schema is not applied until Kit has a migration. This SQL creates user, session, account, and verification with foreign keys and indexes matching the auth schema.
Kit needs the snapshot next to the SQL so later generate/migrate runs can diff against the current database shape instead of regenerating the auth tables.
Sign-in, sign-up, and session requests must hit a server route. toNextJsHandler forwards GET and POST to the Better Auth handler under /api/auth/*.
UI primitives need a project-level shadcn config so the CLI and generated components share aliases, CSS entry, and the Remixicon library used by Blogly.
Auth and theme controls need a consistent button with variants and sizes. This Base UI button is the primitive those surfaces compose.
Sign-in, sign-up, and later blog forms need a styled text input that follows the theme tokens instead of unstyled native controls.
Blog posts and other multi-line fields need a textarea that matches Input styling and theme tokens.
Form controls need associated labels. This primitive wraps the Base UI label so fields stay accessible and visually consistent.
Forms such as remember-me or publish flags need a themed checkbox rather than a native control that ignores the design tokens.
Auth and editor forms group label, control, and error text. Field provides that layout so each screen does not reimplement spacing and invalid styles.
Some fields need prefixes, suffixes, or inline actions. InputGroup composes Input with those addons without custom layout in every form.
Auth screens and post lists need a bordered, padded surface. Card exposes header, title, and content slots for those layouts.
Confirmations and compact auth or editor prompts need a modal. This Base UI dialog provides overlay, title, and close behavior.
Theme switching and later account menus need a keyboard-accessible menu. This primitive is the shared trigger and item implementation.
Session UI will show the signed-in user. Avatar handles image, fallback initials, and sizing from the theme.
Posts and admin lists need small status chips. Badge provides variant styles without one-off span classes.
Menus, cards, and settings sections need a consistent rule. Separator wraps the Base UI separator with theme border color.
Post lists and search results need a dedicated empty state. This primitive standardizes icon, title, and action slots.
Include `.env.example` in version control while ignoring other environment files.
Use Suspense for session-dependent post interactions and replace sanitize-html with a focused htmlparser2-based sanitizer.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request introduces the main application pages, layouts, and loading states for Blogly, along with comprehensive project documentation and environment setup. The changes establish the core structure for authentication, user profiles, post management (including creation, editing, and deletion), and public viewing of posts and profiles. Additionally, it provides technical documentation and environment variable templates to support local development and deployment.
Preview: https://blogly-lemon.vercel.app/
Major features and pages:
Authentication and Session Management:
app/(auth)/signin/page.tsx,app/(auth)/signup/page.tsx). [1] [2]app/(auth)/layout.tsx).User Profiles and Posts:
app/(home)/[username]/page.tsx). (app/(home)/[username]/page.tsxR1-R74)app/(home)/[username]/[slug]/page.tsx). (app/(home)/[username]/[slug]/page.tsxR1-R168)app/(home)/[username]/not-found.tsx). (app/(home)/[username]/not-found.tsxR1-R18)Admin/Post Management:
app/(home)/admin/layout.tsx).app/(home)/admin/page.tsx,app/(home)/admin/new/page.tsx,app/(home)/admin/[postId]/edit/page.tsx). [1] [2] app/(home)/admin/[postId]/edit/page.tsxR1-R44)Supporting features:
Loading and Skeleton States:
app/(home)/[username]/loading.tsx,app/(home)/[username]/[slug]/loading.tsx,app/(home)/admin/loading.tsx). (app/(home)/[username]/loading.tsxR1-R9, app/(home)/[username]/[slug]/loading.tsxR1-R10, app/(home)/admin/loading.tsxR1-R9)Project Documentation and Setup:
BLOGLY.md) covering stack, setup, routes, data model, and screenshots.README.mdto reference the new documentation..env.examplewith required environment variables for local setup.Layout and Structure:
app/(home)/layout.tsx).These changes lay the foundation for Blogly's multi-author blogging platform, supporting authentication, content management, and public content discovery.
References:
[1] [2] [3] app/(home)/[username]/page.tsxR1-R74, app/(home)/[username]/[slug]/page.tsxR1-R168, app/(home)/[username]/not-found.tsxR1-R18, [4] [5] [6] app/(home)/admin/[postId]/edit/page.tsxR1-R44, app/(home)/[username]/loading.tsxR1-R9, app/(home)/[username]/[slug]/loading.tsxR1-R10, [7] [8] [9] [10] [11]