Simple open-source flat-file serverless Content Management Framework (headless-CMS) to build powerful API effortlessly.
- Simple - Designed to replace Wordpress in building simple company / product / event pages
- Fast and lightweight - Serverless oriented, no framework, no database or other system-wide requirements
- Two types of data - Unlike Contentful or Strapi, offers not only items collection, but also single entities, that can be used to build pages or store configuration
- Full internationalization - Every piece content is assigned to one language, so you have complete freedom in customizing it
- No strict schema - Do you need each item within a content type to do be different and have a different structure for each language? No problem, sky is the limit!
- No Admin Panel - You are not limited by the UI or poor UX, just you and bunch of JSON and Markdown files
- Front-end agnostic - Simple REST API can be used by any application
- Add Wombat as dependecy
yarn add @snowdog/wombat
- Create content following Content structure description.
- Add
"dev": "wombat dev"
topackage.json
scripts section - Run
yarn dev
and enjoy working with your new API
This guide is for ZEIT Now, but setting up any other serverless env looks simillar.
- In
package.json
add automatic DB building after installing dependecies"scripts": { "postinstall": "wombat build", "dev": "wombat dev" }
- Define new builds and routes in
now.json
acording to the example - Copy collection.js and entity.js from examples
- Deploy your app via
now
defaultLang
(defaulten
) - Fallback language when request is send withoutlang
query param.port
(default3000
, only for development purpouses) Port used by the web server to listen for requests.
All content is kept in /content
directory.
Inside you need to define supported languages. For example, we want to have content just in English, so it will be /content/en
.
Wombat supports two data types:
Designed to store sets of similar data, like blog posts, authors, job offers etc.
- Collections are stored in
collection
directory inside each language. - Each collection and item of collection needs to be added as a directory.
- Every property of an item collection needs to be a separate JSON or Markdown file.
Created to keep a single object like a landing page content or global configuration.
- Entities are stored in
entity
directory inside each language. - Each entity needs to be added as a directory.
- Every property of entity needs to be a separate JSON or Markdown file.
- You can define the relation between entity and collection.
Create new JSON file inside entity directory to define relation:
{
"query": {
"name": "collectionName", // (required) collection name
"sortBy": "title", // prop name used for sorting
"sort": "asc", // `desc` is default - `sortBy` required to use it
"limit": 2, // limit numer of returned items
"page": 1, // page number
"perPage": 100, // numer of items per page
"items": ["award", "about", "partner"], // Array of collection items IDs. Items order is preserved.
"props": ["id", "content"] // return only selected object props
}
}
content
└── en
├── collection
| └── blog
| └── why-wombat-poop-is-cube
| | ├── content.md
| | ├── featured-image.json
| | └── title.json
| └── things-you-dont-know-about-wombats
| ├── content.md
| ├── featured-image.json
| ├── form-config.json
| └── title.json
└── entity
└── home
├── blog-posts.json
├── about.md
└── hero-banner.json
Retrieve an entity item.
Example:
To get home
entity send request to /entity?name=home
.
URL params:
name
- (required) Name of entitylang
- Return content in given lang.
Retrieve the whole collection as array.
Examples:
/collection?name=blog
/collection?name=blog&props=title,title
/collection?name=blog&items=why-wombat-poop-is-cube,things-you-dont-know-about-wombats
/collection?name=blog&limit=2&sortBy=title&sort=desc
/collection?name=blog&page=2&perPage=5
URL params:
name
- (required) Name of collection.lang
- Return content in given lang.sortBy
- Prop name used for sorting.sort
-desc
is default -sortBy
required to use it.limit
- Limit numer of returned items.page
- Page number.perPage
- Numer of items per page.items
- Comma separated list of collection items IDs. Items order is preserved.props
- Comma separated list of selected object props, GraphQL-like.