#Is there a way I can put my middleware.ts file inside app/
1 messages · Page 1 of 1 (latest)
Hi @warped granite. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
According to the information provided in the extracts, the middleware.ts file should be placed at the root of your project or inside the src directory if you're using one. It should be at the same level as your pages or app directory. Placing the middleware.ts file inside the app directory is not recommended and may cause issues with your middleware not triggering correctly.
Here is the recommended project structure:
- my-project
- middleware.ts
- app
- secret-page
- page.tsx
- login
- page.tsx
- page.tsx
- secret-page