Naming conventions
snake_case Go, kebab-case TS, plural routes, plural tables.
Grit names things consistently so you never have to guess what to call your new file. This is a 5-minute lesson — but it's the one that makes your future code look like it belongs.
The full table
| Thing | Convention | Example |
|---|---|---|
| Go files | snake_case | user_handler.go |
| Go structs | PascalCase | type User struct |
| Go funcs (exported) | PascalCase | GetUsers() |
| Go funcs (private) | camelCase | parseToken() |
| TS files | kebab-case | use-users.ts |
| React components | PascalCase | DataTable.tsx |
| API routes | plural, lowercase | /api/users |
| DB tables | plural snake_case | blog_posts |
| Zod schemas | PascalCase + Schema | UserSchema |
The pattern behind the table
Three principles cover everything:
- Go uses snake_case for filenames + PascalCase for types and exported funcs. That's the Go community convention. Grit doesn't fight it.
- TS uses kebab-case for filenames + PascalCase for components. The kebab-case convention is from React Router / Next.js — readable in URLs.
- API routes and DB tables are plural.
/api/users,userstable — a user is a single resource; the collection is plural. Avoids the "is it /user or /users?" debate.
Quick check
Try it
Look at your scaffolded project. Find three files across web, admin, and api — pick one from each. In notes.md, write the filename + which convention it follows.
What's next
Files are named. Next — how Grit's API responses are shaped. One envelope every endpoint follows. Memorise it once, use it forever.
Spot a typo? Have an idea?
Help us improve this lesson. One click opens a GitHub issue with the lesson URL pre-filled — suggest clearer wording, report a bug, or request more depth. The course keeps improving thanks to learners like you.
Suggest an improvement on GitHub