A client arrives with a ready-made React application — content lives in JSON files. Each release involves copying data via Slack, edits get lost, microcontrollers go haywire. Switching to Contentful is a lifesaver, but a wrong content schema turns the CMS into a swamp. Mistakes in field types or missing validation kill scalability. We configure the Space so that developers and content managers don't curse everything in sight.
Over 5+ years of working with Contentful, we've accumulated hundreds of hours of optimization. For example, one client was losing up to 20% of content during manual migration — after setting up the Space with automatic validation, errors disappeared completely. The cost of such setup varies depending on model complexity and number of environments. Below are the key stages of professional setup.
How to Design a Content Model for Scale?
Content Model is the skeleton of the project. Improper normalization leads to N+1 queries and overcomplicated editor forms. We follow the rule: one content type — one entity (article, author, category). For a blog, 4–6 types are enough. Example structure:
| Component | Field Type | Validation | Localization |
|---|---|---|---|
| title | Short text | required, unique | yes |
| slug | Short text | unique, regex: ^[a-z0-9-]+ | no |
| content | Rich Text | required | yes |
| heroImage | Media (image) | - | no |
| author | Reference | 1:1 to Author | no |
| categories | References | many to Category | no |
Example Content Model for an e-commerce store
- Product: title, slug, description, price, images, categories
- Category: name, slug, parent (self-reference)
- Brand: name, logo, website
- Page: title, slug, content (Rich Text)
Only 4 types with minimal depth. Normalization avoids data duplication.
Use field-level locale for SEO fields (title, description) — this provides flexibility without duplicating content. According to Contentful's official documentation, proper localization with field-level locale reduces duplicate fields by 40%. For projects with 5+ locales, we recommend not exceeding 10 Content Types — otherwise editor interface performance drops.
GUI, CLI, or Codegen?
CLI approach is 3 times faster than manual GUI creation and allows versioning the model in Git. Compare:
| Method | Speed | Versioning | Typing |
|---|---|---|---|
| GUI | ~1 hour | no | no |
| CLI | ~15 minutes | yes (JSON) | no |
| Codegen | ~1 minute | yes (TypeScript) | full |
For production, we combine CLI + codegen: export model, edit JSON, import via CI. This saves 2 days on every model change and reduces content management costs by 30–50%. Contact us for a Space architecture consultation — we'll analyze your model in 30 minutes.
Environment Setup and API Tokens
Use separate environments for staging and production. Each environment has its own CDA, Preview, and CMA tokens. Never use a CMA token on the frontend — it's a security hole.
# Create staging environment and copy model from master contentful space environment create --name staging \ --environment-id staging --source master In the frontend SDK, use the CDA token with the staging environment:
const client = createClient({ space: SPACE_ID, accessToken: STAGING_CDA_TOKEN, environment: 'staging', }) Automating Model Export to Git
Use Contentful CLI to export the model without content:
contentful space export --space-id xxx --skip-content --export-dir ./model The file contentful-export-xxx.json is stored in the repository. When the model changes, import via CI into the appropriate environments. This eliminates human error and speeds up deployments. According to Contentful official documentation, this is a best practice for team collaboration.
Generating TypeScript Types from the Content Model
Codegen via cf-content-types-generator creates full interfaces:
npx cf-content-types-generator \ --spaceId YOUR_SPACE_ID \ --token YOUR_CMA_TOKEN \ --out ./src/types/contentful.d.ts After that, importing import { IBlogPost } from './types/contentful' gives autocomplete and error protection. Saves 1–2 hours of manual TypeScript type definitions per project.
Step-by-Step Space Setup Guide
- Requirements analysis — define content types, fields, validations (1 hour).
- Create Space and environments — master, staging, dev via CLI (15 minutes).
- Design and import Content Model — create JSON schema, import via CLI (30 minutes).
- Type generation and documentation — codegen TypeScript, write readme (1 hour).
Full setup takes 1–2 days and reduces operational costs by 20–30%. Typical setup cost depends on scope. Savings on manual content migration can reach significant amounts.
What's Included in Our Work?
- Requirements analysis and Content Model design
- Space and environment creation (production, staging, dev)
- API token setup (CDA, Preview, CMA)
- Model import/export via CLI, CI/CD integration
- TypeScript type generation and integration
- Documentation for content managers
We guarantee: no extra fields, full validation at the CMS level, architecture ready to scale. We've been working with Contentful for over 5 years — during that time we've completed more than 30 projects of varying complexity. A typical project (4–6 Content Types, 2 locales, 2 environments) is set up in 1–2 days. The cost is calculated individually — depends on model complexity and automation requirements. Just get in touch — we'll prepare the architecture and a precise plan.







