# njin > One model in, a REST API, an admin panel and a server-rendered website out. Built for people and AI agents. njin is a full-stack web framework for Bun. You define your content once as a Zod model, and njin generates the REST API, the admin panel, validation and server-rendered pages from it. AI agents can read and manage the content over MCP. - Source: https://github.com/njinlabs/njin - npm: https://www.npmjs.com/package/@njinlabs/njin - Full docs in one file: https://njin.run/llms-full.txt ## Getting started - [Introduction](https://njin.run/docs/getting-started/introduction): What njin is, who it is for, and what you can build with it. - [Installation](https://njin.run/docs/getting-started/installation): Create a new njin project and run it locally. - [Folder structure](https://njin.run/docs/getting-started/folder-structure): What each file and folder in a njin project is for. - [Your first model](https://njin.run/docs/getting-started/your-first-model): Define a model, edit it in the admin panel, and show it on a page. - [FAQ](https://njin.run/docs/getting-started/faq): Short answers to common questions about njin. ## Models - [Defining a model](https://njin.run/docs/models/defining-a-model): Describe your content once and get an API and an admin screen. - [Field types](https://njin.run/docs/models/field-types): The field helpers you can use in a model's schema. - [Validation](https://njin.run/docs/models/validation): Required fields, chained rules, defaults and unique values. - [Relations](https://njin.run/docs/models/relations): Link records to each other with relation and relationMany. - [Files and uploads](https://njin.run/docs/models/files): Attach uploaded files to records and choose where files are stored. - [Draft and publish](https://njin.run/docs/models/draft-and-publish): Keep a live copy of each record apart from the one being edited. - [Languages (i18n)](https://njin.run/docs/models/languages): Store and serve content in more than one language. - [Hooks](https://njin.run/docs/models/hooks): Run code before or after a model is created, updated, deleted or published. ## Vars - [Defining vars](https://njin.run/docs/vars/defining-vars): Singleton settings such as the site name or SEO defaults. - [Using vars in templates](https://njin.run/docs/vars/using-vars): Read and update settings from templates, code and the API. - [Drafts and languages](https://njin.run/docs/vars/drafts-and-languages): Give a settings group a live copy and a value per language. ## Website - [File-based routing](https://njin.run/docs/website/routing): How files in src/views/pages become URLs. - [Layouts and pages](https://njin.run/docs/website/layouts-and-pages): Share a page shell, build reusable components and customize error pages. - [Template globals](https://njin.run/docs/website/template-globals): The variables and functions available in every template. - [Reading data](https://njin.run/docs/website/reading-data): Load records in templates with read() and show(). - [EdgeJS cheatsheet](https://njin.run/docs/website/edge-syntax): The template syntax you use most in njin pages. - [Static assets](https://njin.run/docs/website/static-assets): Serve images and other files that never change. - [Image optimization](https://njin.run/docs/website/image-optimization): Serve resized WebP images on the fly. - [Tailwind and Alpine.js](https://njin.run/docs/website/tailwind-and-alpine): Style pages with Tailwind CSS and add interactivity with Alpine.js. - [Static page caching](https://njin.run/docs/website/static-caching): Serve pages from cached HTML and refresh them when content changes. ## Extending - [Helpers](https://njin.run/docs/extending/helpers): Add your own functions to every template. - [Events](https://njin.run/docs/extending/events): Notify other parts of your app that something happened. - [Custom routes](https://njin.run/docs/extending/custom-routes): Add your own server endpoints, such as webhooks. - [Custom MCP tools](https://njin.run/docs/extending/mcp-tools): Give AI agents your own actions on top of the built-in content tools. - [Plugins](https://njin.run/docs/extending/plugins): Bundle models, routes, events and admin pages into something reusable. ## REST API - [Authentication](https://njin.run/docs/rest-api/authentication): Sign in, send credentials and see what a caller may do. - [Model endpoints](https://njin.run/docs/rest-api/model-endpoints): The endpoints every registered model gets. - [Filtering and pagination](https://njin.run/docs/rest-api/filtering-and-pagination): Search, filter, sort and page a list with query parameters. - [Files](https://njin.run/docs/rest-api/files-api): Upload, list, delete and serve files over the API. - [Users and tokens](https://njin.run/docs/rest-api/users-and-tokens): Manage users, access groups and tokens over the API. - [Analytics](https://njin.run/docs/rest-api/analytics): Page view statistics, collected automatically. - [Errors](https://njin.run/docs/rest-api/errors): Status codes and the shape of error responses. ## Access control - [Overview](https://njin.run/docs/access-control/overview): How njin decides who can do what. - [Grants](https://njin.run/docs/access-control/grants): The syntax of a grant, and what own, all and reference access mean. - [Tokens and scopes](https://njin.run/docs/access-control/tokens-and-scopes): Give a script or an AI agent less access than its owner has. - [Code you write](https://njin.run/docs/access-control/your-own-code): Permissions are not checked in your own code. Here is how to guard it. ## AI agents - [Building with a coding agent](https://njin.run/docs/ai-agents/coding-agents): Let an AI coding agent add models and pages to your njin project. - [Managing content over MCP](https://njin.run/docs/ai-agents/mcp): Connect an AI agent to your site so it can read and edit content. - [Connected apps](https://njin.run/docs/ai-agents/connected-apps): Review, narrow and revoke what AI agents are allowed to do. ## Operations - [Configuration](https://njin.run/docs/operations/configuration): Every option of config.ts, and how to use environment variables. - [Testing](https://njin.run/docs/operations/testing): Test your real app without opening a port. - [Building and deploying](https://njin.run/docs/operations/deploying): Build for production and run your site on a server. - [Updating njin](https://njin.run/docs/operations/updating): Update the framework and the admin panel.