Skip to content

Implement an auth guard and openapi-ts#22

Merged
MeesMaas merged 7 commits into
developmentfrom
feature/new-boilerplate-react-router
Dec 10, 2025
Merged

Implement an auth guard and openapi-ts#22
MeesMaas merged 7 commits into
developmentfrom
feature/new-boilerplate-react-router

Conversation

@MeesMaas
Copy link
Copy Markdown
Contributor

No description provided.

@MeesMaas MeesMaas requested review from JortWillemsen, Copilot and rensvmoorsel and removed request for Copilot December 10, 2025 11:09
@MeesMaas MeesMaas changed the title Implement an auth guard an openapi-ts Implement an auth guard and openapi-ts Dec 10, 2025
JortWillemsen
JortWillemsen previously approved these changes Dec 10, 2025
Comment thread Frontend/app/layout/auth.tsx Outdated
Comment thread Frontend/app/root.tsx
Comment thread Frontend/app/root.tsx
Comment thread Frontend/app/routes/home.tsx
Comment thread Frontend/app/util/date.util.ts Outdated
JortWillemsen
JortWillemsen previously approved these changes Dec 10, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements authentication infrastructure for the application by adding session-based authentication with cookie storage, an auth guard middleware to protect routes, and integrates OpenAPI TypeScript client generation for type-safe API calls. It also updates the Docker configuration to properly expose the Vite development server port.

Key changes:

  • Implements session-based authentication with login, logout, and registration routes
  • Adds requireAuth middleware to protect routes from unauthorized access
  • Integrates @hey-api/openapi-ts for generating type-safe API client code from OpenAPI specifications
  • Updates frontend port mapping from 3000 to 5173 to match Vite's default development server

Reviewed changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
compose.yaml Updates frontend port mapping to 5173 for Vite dev server
Frontend/package.json Adds openapi-ts dependency and script for API client generation
Frontend/openapi-ts.config.ts Configures OpenAPI code generation targeting local backend
Frontend/yarn.lock Adds dependency lock entries for openapi-ts and related packages
Frontend/app/sessions.server.ts Implements cookie-based session storage for authentication tokens
Frontend/app/middleware/auth.ts Provides auth guard to protect routes requiring authentication
Frontend/app/routes/auth/login.tsx Implements login page with form handling and session management
Frontend/app/routes/auth/register.tsx Implements registration page UI (form handling not yet implemented)
Frontend/app/routes/auth/logout.tsx Implements logout by destroying session and redirecting
Frontend/app/routes.ts Updates routing configuration with auth layout and protected routes
Frontend/app/root.tsx Configures API client with auth token from session and adds response interceptor
Frontend/app/layout/auth.tsx Provides layout wrapper for authentication pages
Frontend/app/routes/home.tsx Updates home page to be protected and demonstrate API calls
Frontend/app/util/date.util.ts Adds utility for formatting dates in various formats
Frontend/app/api/* Auto-generated TypeScript API client code from OpenAPI spec
.gitattributes Marks auto-generated API files as linguist-generated
.devcontainer/devcontainer.json Updates port forwarding and labels for new frontend port
Comments suppressed due to low confidence (1)

Frontend/app/routes/auth/login.tsx:32

  • This guard always evaluates to false.
  if (userId == null) {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Frontend/app/sessions.server.ts Outdated
Comment thread Frontend/app/sessions.server.ts Outdated
Comment thread Frontend/app/routes/auth/login.tsx Outdated
Comment thread Frontend/app/middleware/auth.ts Outdated
Comment thread Frontend/app/middleware/auth.ts Outdated
Comment thread Frontend/app/layout/auth.tsx
Comment thread Frontend/app/routes/auth/register.tsx
Comment thread Frontend/app/middleware/auth.ts Outdated
Comment thread Frontend/app/middleware/auth.ts Outdated
Comment thread Frontend/app/routes/home.tsx
@MeesMaas
Copy link
Copy Markdown
Contributor Author

ugh Copilot. Die stond kennelijk nog aan in mijn instellingen

Copy link
Copy Markdown

@JortWillemsen JortWillemsen left a comment

Choose a reason for hiding this comment

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

Damn clankers

@MeesMaas MeesMaas merged commit 897c1d4 into development Dec 10, 2025
1 check passed
@MeesMaas MeesMaas deleted the feature/new-boilerplate-react-router branch December 10, 2025 11:53
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.

3 participants