Learn GRAILS with Real Code Examples
Updated Nov 27, 2025
Installation Setup
Install JDK 11+ and Groovy
Install Grails SDK via SDKMAN or direct download
Create a new project using `grails create-app myapp`
Configure `application.yml` for database and environment settings
Run `grails run-app` to start the development server
Environment Setup
Install JDK and Groovy
Install Grails SDK
Create project via CLI
Configure database and environment
Run local server and verify setup
Config Files
grails-app/conf/application.yml - main configuration
grails-app/controllers/ - controllers
grails-app/domain/ - domain classes
grails-app/services/ - services
grails-app/views/ - GSP templates
Cli Commands
grails create-app myapp - create project
grails create-controller <name> - generate controller
grails create-domain-class <name> - generate domain class
grails run-app - start dev server
grails test-app - run tests
Internationalization
Message bundles for multiple languages
UTF-8 support for content
Locale switching via controllers
Pluralization and formatting supported
Integrate with external i18n libraries if needed
Accessibility
Accessible via web browser
Supports internationalization
GSP templates can include ARIA attributes
Forms can be made fully accessible
Testing with Spock or Selenium
Ui Styling
GSP templates for HTML
Integrate CSS frameworks (Bootstrap/Tailwind)
Frontend bundlers (Webpack, Gradle plugins)
TagLibs for reusable UI components
Optional integration with Vue, React, or Angular
State Management
Domain classes manage persistence state
Sessions and cache store temporary state
Controllers coordinate request/response
Services encapsulate business logic
Events trigger decoupled operations
Data Management
Database handled via GORM
Entities mapped to tables
Migrations handled via GORM or plugins
Caching used for performance
Logs track application activity