···2929- **SQLight** - SQLite database driver
3030- **Storail** - Session management
3131- **Glow Auth** - OAuth utilities
3232+- **Squall** - Type-safe GraphQL code generator
32333334### Shared
3435- Monorepo structure with shared types and utilities between client and server
···188189Profile pages include prerendered data in the initial HTML response, embedded as JSON in a script tag for instant hydration.
189190190191### GraphQL Integration
191191-Direct queries and mutations to the Slices network API for ATProto profile data with access token support.
192192+Type-safe GraphQL queries and mutations generated from `.gql` files using Squall. All GraphQL operations are defined in `server/src/api/graphql/` and automatically generate type-safe Gleam code with decoders and input types.
193193+194194+To regenerate GraphQL code after modifying `.gql` files:
195195+```bash
196196+cd server
197197+make generate-graphql
198198+```
192199193200## Building for Production
194201
···11+.PHONY: help download-schema generate-graphql dev test build
22+33+GRAPHQL_ENDPOINT := https://api.slices.network/graphql?slice=at://did:plc:bcgltzqazw5tb6k2g3ttenbj/network.slices.slice/3m3gc7lhwzx2z
44+55+help: ## Show this help message
66+ @echo 'Usage: make [target]'
77+ @echo ''
88+ @echo 'Available targets:'
99+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-20s %s\n", $$1, $$2}'
1010+1111+download-schema: ## Download GraphQL schema from endpoint
1212+ @echo "Downloading GraphQL schema from $(GRAPHQL_ENDPOINT)..."
1313+ @npx get-graphql-schema $(GRAPHQL_ENDPOINT) > schema.graphql
1414+ @echo "Schema saved to schema.graphql"
1515+1616+generate-graphql: ## Regenerate GraphQL type-safe code from .gql files
1717+ gleam run -m squall generate "$(GRAPHQL_ENDPOINT)"
1818+1919+dev: ## Run the development server
2020+ gleam run
2121+2222+test: ## Run tests
2323+ gleam test
2424+2525+build: ## Build the project
2626+ gleam build
+32
server/README.md
···2222gleam run # Run the project
2323gleam test # Run the tests
2424```
2525+2626+## GraphQL Code Generation
2727+2828+This project uses [Squall](https://github.com/bigmoves/squall) to generate type-safe GraphQL queries from `.gql` files.
2929+3030+### Regenerating GraphQL Code
3131+3232+After modifying any `.gql` files in `src/api/graphql/`, regenerate the type-safe Gleam code:
3333+3434+```sh
3535+# Using make (recommended)
3636+make generate-graphql
3737+3838+# Or directly with gleam
3939+gleam run -m squall generate "https://api.slices.network/graphql?slice=at://did:plc:bcgltzqazw5tb6k2g3ttenbj/network.slices.slice/3m3gc7lhwzx2z"
4040+```
4141+4242+This will:
4343+- Introspect the GraphQL schema
4444+- Find all `.gql` files in `src/api/graphql/`
4545+- Generate type-safe `.gleam` files with decoders and input types
4646+4747+### GraphQL Queries
4848+4949+All GraphQL operations are defined in `src/api/graphql/`:
5050+- `get_profile.gql` - Fetch profile by handle
5151+- `upload_blob.gql` - Upload blob mutation
5252+- `update_profile.gql` - Update profile mutation
5353+- `check_profile_exists.gql` - Check if profile exists
5454+- `sync_user_collections.gql` - Sync user collections
5555+- `get_bluesky_profile.gql` - Get Bluesky profile
5656+- `create_profile.gql` - Create new profile