CMS (Content Management System)
Frontend Cloud includes a powerful Content Management System (CMS) that allows you to create and manage structured data for your application. Using the CMS, you can define collections (database tables) and store documents (data records) that power dynamic content in your app.
Creating Collections
Section titled “Creating Collections”Collections define the structure of data you want to store in your application. You can use Frontend AI to create collections by describing what you need:
- Profiles: User profile information and settings
- Places: Locations, venues, or geographic data
- Events: Scheduled activities, appointments, or occurrences
- Products: Catalog items for e-commerce
- Posts: Blog articles, news items, or content
- Reviews: Customer feedback and ratings
Simply ask the Frontend AI to create a collection with the fields you need, and it will set up the structure automatically.
Collection Naming
Section titled “Collection Naming”Collection names are automatically formatted to follow best practices:
- Pluralized: “Profile” becomes “profiles”
- Lowercased: “Product” becomes “product”
- No Spaces: “Product Review” becomes “productreviews”
This automatic formatting ensures consistency and follows database naming conventions without requiring manual configuration.
Field Types
Section titled “Field Types”Collections support a variety of field types to match your data needs:
- String: Short text fields (names, titles, URLs)
- Text: Long-form content (descriptions, articles, comments)
- Int: Integer numbers (quantities, ages, ratings)
- Float: Decimal numbers (prices, percentages, measurements)
- Image: Image uploads and references
- Boolean: True/false values (active status, feature flags)
Each field can be configured with validation rules and default values to ensure data integrity.
Permissions
Section titled “Permissions”Every collection has granular permissions that control who can access and modify data. Permissions can be set for four operations:
- Create: Who can add new documents to the collection
- Read: Who can view documents in the collection
- Write: Who can update existing documents
- Delete: Who can remove documents from the collection
Permission Levels
Section titled “Permission Levels”Permissions can be assigned to three user types:
- Anonymous: Public, non-logged-in users
- Authenticated: Any logged-in user
- Owner: The specific user who created the document
Permission Examples
Section titled “Permission Examples”Product Reviews Collection:
- Create: Authenticated (only logged-in users can write reviews)
- Read: Anonymous (everyone can read reviews)
- Write: Owner (only the review author can edit their review)
- Delete: Owner (only the review author can delete their review)
This configuration allows public access to reviews while preventing unauthorized modifications.
User Profiles Collection:
- Create: Authenticated (users create their own profiles)
- Read: Authenticated (only logged-in users can view profiles)
- Write: Owner (users can only edit their own profile)
- Delete: Owner (users can delete their own profile)
This setup keeps user profiles private and ensures users only modify their own data.
Public Blog Posts Collection:
- Create: Authenticated (logged-in users can create posts)
- Read: Anonymous (everyone can read blog posts)
- Write: Owner (only the post author can edit)
- Delete: Owner (only the post author can delete)
This allows public content consumption while restricting content management to creators.
Managing Collections
Section titled “Managing Collections”You can edit and modify collections in the Frontend CMS panel:
- Add or remove fields from existing collections
- Change field types and validation rules
- Update permission settings
- View collection statistics and usage
- Export collection data
The CMS panel provides a visual interface for managing your data structure without writing code.
Documents
Section titled “Documents”Documents are individual records within a collection, similar to rows in a database table. Each document stores specific data that matches the collection’s structure.
Creating Documents
Section titled “Creating Documents”Documents can be created in two ways:
- Frontend Dashboard: Manually create documents through the CMS interface
- Your Application: Programmatically create documents via API endpoints
For example, user-generated content (reviews, posts, comments) would be created by your app, while admin content (featured items, site settings) might be created in the dashboard.
Published Status
Section titled “Published Status”Documents have a published status that controls their visibility:
- Published Documents: Available and visible to your frontend application
- Unpublished Documents: Hidden from the frontend, only visible in the CMS dashboard
Important: Only published documents will be exposed to the frontend. This allows you to:
- Draft content before making it live
- Review and edit documents without affecting your live site
- Schedule content by publishing when ready
- Hide outdated or archived content without deleting it
When querying documents through the API, only published documents are returned to your application, ensuring that draft or private content remains hidden from users.
API Access
Section titled “API Access”Your application can interact with the CMS using REST API endpoints at /api/v1/cms:
HTTP Methods
Section titled “HTTP Methods”- POST: Create new documents
- GET: Retrieve documents
- PUT: Update existing documents
- DELETE: Remove documents
Example API Calls
Section titled “Example API Calls”// Create a new documentPOST /api/v1/cms/reviews{ "productId": "123", "rating": 5, "comment": "Great product!", "active": true}
// Get documents from a collectionGET /api/v1/cms/reviews
// Update a documentPUT /api/v1/cms/reviews/doc_abc123{ "rating": 4, "comment": "Updated review"}
// Delete a documentDELETE /api/v1/cms/reviews/doc_abc123Advanced Queries
Section titled “Advanced Queries”The CMS API supports powerful querying capabilities:
Full-Text Search
Section titled “Full-Text Search”Search across text fields in your collection:
GET /api/v1/cms/reviews?query=excellent+productFiltering
Section titled “Filtering”Filter documents by field values:
GET /api/v1/cms/reviews?active=true&rating=5Pagination
Section titled “Pagination”Control the number of results and which page to retrieve:
GET /api/v1/cms/reviews?page=1&perPage=20Combined Query Example
Section titled “Combined Query Example”GET /api/v1/cms/reviews?query=great&active=true&page=1&perPage=20This query searches for “great” in active reviews, returning the first 20 results.
Using Frontend AI
Section titled “Using Frontend AI”Instead of manually writing API calls, you can direct Frontend AI to manage collections and documents:
- “Create a new collection for product reviews with rating and comment fields”
- “Fetch all active blog posts from the CMS”
- “Update the user profile document for the current user”
- “Delete the review with ID abc123”
- “Search for events in the next 30 days”
The AI will generate the appropriate API calls and handle the integration automatically.
Best Practices
Section titled “Best Practices”When working with the CMS:
- Plan your collections: Think through your data structure before creating collections
- Use appropriate permissions: Protect sensitive data with proper permission settings
- Leverage field types: Choose the right field type for each piece of data
- Implement validation: Use field validation to ensure data quality
- Test permissions: Verify that your permission settings work as intended
- Use pagination: Don’t load all documents at once for large collections
- Index for search: Consider which fields need to be searchable
- Monitor usage: Keep track of collection sizes and query performance
Frontend Cloud CMS provides a flexible, powerful way to manage your application’s data without the complexity of setting up and maintaining a separate database infrastructure.