API / Apache Grails Interview questions
What is the difference between Grails profiles like "web" and "rest-api"?
A Grails profile determines the base project structure, default dependencies, and starting conventions a generated application uses — picking one when creating a project shapes what the initial skeleton looks like and which patterns feel like the default going forward.
| web profile | rest-api profile |
| Includes GSP view support out of the box | Omits GSP dependencies by default, focused on JSON responses |
| Scaffolding targets full CRUD with views | Scaffolding/generators target REST-style controllers returning data, not HTML |
| Best fit: traditional server-rendered web applications | Best fit: backend services consumed by a separate frontend (SPA, mobile app) |
| URL mapping conventions assume HTML page navigation | URL mapping conventions lean toward resource-style REST endpoints |
Choosing the wrong profile at project creation time isn't fatal — dependencies and conventions can still be adjusted manually afterward — but starting with the profile that actually matches the application's intended shape avoids pulling in view-rendering machinery a pure API backend doesn't need, or missing GSP support a traditional web app expects out of the box.
More Related questions...