Alinea generates files on your file system in two places. First content will be placed in a directory as json files. Second a library is generated inside the .alinea folder which allows us to interact with the content in JavaScript.
// Published content is stored in json files
// inside the content directory
content
├ data // data root
│ ├ index.json
│ ├ blog.json
│ ╰ blog
│ ├ blog-post.json
│ ╰ another-blog-post.json
╰ media // media root
├ image.png.json
╰ file.pdf.json
// The alinea directory exports a javascript library
// per workspace
.alinea
╰ web
For each workspace a few exports can be found under .alinea/$workspace. In the example above we can query pages of the web workspace by importing its Pages instance.
import {pages} from '.alinea/web/pages'
const blog = await pages.findFirst(page => page.type.is('BlogOverview'))
const posts = await blog.tree.children()
For each type defined in the workspace schema a Collection is exported. Collections are used to point at specific fields when querying.
import {pages} from '.alinea/web/pages'
import {Animal, Fruit} from '.alinea/web'
const page = await pages.findFirst(
Animal.age.greater(10)
)
const pages = await pages.findMany(
Fruit.title.isIn(['apple', 'orange'])
)