feat: implement monorepo setup, middleware auth, and centralized routing - #162
Merged
dark-sarge merged 1 commit intoAug 24, 2026
Merged
Conversation
- Set up pnpm workspaces with Turborepo for monorepo management - Create shared packages workspace with common TypeScript types - Implement Next.js middleware for server-side route protection - Add JWT validation and admin role verification in middleware - Refactor server routing with centralized registerRoutes function - Add stub routers for webhooks and admin endpoints - Configure Jest for frontend middleware testing - Update .gitignore to exclude PR markdown files and .kiro directory Closes arflexx#92, arflexx#123, arflexx#126, arflexx#139
|
@Hydrax117 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Pull Request: Monorepo Setup, Middleware Auth, and Centralized Routing
Overview
This PR implements three major infrastructure improvements to the AirFlex project:
Related Issues
closes #92
closes #123
closes #126
closes #139
Changes Made
1. Monorepo Setup (#92)
pnpm-workspace.yamlwith workspace configuration forapps/*,packages/*,frontend, andserverpackage.jsonwith workspace scripts (dev, build, lint, test, clean)turbo.jsonwith pipeline caching for build, lint, and test taskspackages/shared/workspace package with common TypeScript types:TradeOfferinterfaceTradeStatusenumUserinterfacefrontend/package.jsonandserver/package.jsonto use@airflex/shared: workspace:*server/package-lock.jsonto convert from npm to pnpmpnpm-lock.yamlat root for unified dependency management2. Next.js Middleware for Route Protection (#123)
frontend/middleware.tswith path matcher for protected routes:/wallet/:path*/sell/:path*/profile/:path*/admin/:path*/onboarding/:path*/adminroutes (redirects non-admin users to/)X-User-Idheader to forwarded requests for server components/,/auth/:path*,/trades/:path*) explicitly excluded from matcherfrontend/middleware.test.tswith 9 passing unit testsjest.config.js,jest.setup.js) and dependenciesfrontend/tsconfig.jsonto include Jest types3. Centralized Server Routing (#126, #139)
server/src/routes/index.tswithregisterRoutes(app: Express): voidfunction/api/v1prefix:/api/v1/auth(existing auth router)/api/v1/trades(existing trades router)/api/v1/wallet(existing wallet router)/api/v1/profile(existing profile router)/api/v1/webhooks(new stub router)/api/v1/admin(new stub router)/api/events(existing SSE events router, kept at current path for compatibility)server/src/routes/webhooks.tswith 501 Not Implemented endpointsserver/src/routes/admin.tswith 501 Not Implemented endpointsserver/src/index.tsto callregisterRoutes(app)after middleware setup/healthroute remains directly on app (not under/api/v1) as process probe4. Configuration Updates
.gitignoreto exclude:pr-*.md(pull request description files).kiro/(Kiro IDE directory)frontend/next.config.tstofrontend/next.config.js(Next.js 14 doesn't support .ts config)reactStrictMode: trueandimages.domainsarray to Next.js configTesting
tsc --noEmit)pnpm installBreaking Changes
/api/v1prefix (except/healthand/api/events)Migration Notes
/api/v1prefixpnpm installfrom root to install workspace dependenciesChecklist