How to use next.js in front-end of an Adonis project?
I recommend to separate the api and front-end.
You have to create Adonisjs and nextjs project separately.
It will have lot of benefits to be honest
I second Karthick-Ramachandra.
I tried doing an Adonis fullstack app and bringing in Vue.js as I needed it, but wound up completely rewriting as separate projects, one for the front-end client (Nuxt.js) and one for the backend (Adonis)
I’m almost two weeks into development and loving this combo! I’ve spent years looking for a Good SPA and Relational Database Backed API Combo. I’ve tried lots in many languages. I’ve built large applications with Express and MongoDB, but adding the SPA and realtime stuff in bits and pieces was messy. Granted I love MongoDB, but there is so much hype around NoSQL when your data is really relational that you have to cut so many corners (fancy aggregates, manual joins, data duplication, etc) just to make real things work beyond fancy, realtime, single model todo-list tutorials lol.
Thats why of love the Lucid ORM. The SQL is a bit slower, than a NoSQL setup like MongoDB, but it really makes you think about your data and build a better app. Like Mr. Virk has said (can’t remember exactly where) for most purposes, a 40ms response time vs a 17ms response time is totally worth the added sanity and makes no real different to your end user. Despite my unrealistic addiction to high-performance things, I agree after using AdonisJS for a few weeks!
Another pro is if you make a nice API with stateless authentication, (I’m using JWT), then adding a mobile app in the future is easy and it scales well!
Sorry, I know this was a rant a bit off-topic, I’m just saying I’ve been in your shoes! Good Luck!