Repository Implementation
This page lists every step of putting the Rule Repository (RR), Audit and the MCP server into a web application, in the order that works best, with a link to the page that explains each step. Use it to plan the work, to hand it to a team, or to give it to an AI coding agent as its task list. Steps marked (optional) depend on which features you offer.
Estimated Time to Production
Referencing the libraries and scripts, running the database scripts and creating the database logins, setting up the endpoint, the configuration and its security, and setting up Audit and rule evaluation in your production code typically takes:
- A junior .NET developer: 3 to 4 days, plus 1 to 2 days of testing.
- An AI coding agent: 1 to 2 hours, plus 1 to 2 days of testing. Give it this page as its task list; the facts at the end are written for it.
The figures assume an existing ASP.NET application with its source objects already in place and a deployment process that works. They do not include deciding your roles and permissions, your organization's approvals, or writing the rules themselves. They are typical, not a commitment. A stand-alone implementation of the Rule Editor and the Rule Engine that builds its own rule storage, versioning and testing usually takes a team of two or three developers 2 to 4 months; see Code Effects Implementation.
1. Decide the Shape
2. Secure the Host First
See Security.
3. Create the Database
See The Database.
4. Add the Packages
5. Wire the Server
6. Put the Source Objects In
See Source Sync and Versioning.
7. Build the Page
See The Client.
8. Connect It to Your Processes
9. Add Audit (optional)
See Audit, Recording Evaluations and Audit Settings.
10. Add the AI Features (optional)
11. Before Production
12. With Every New Release
Facts for AI Coding Agents
If you are an AI agent implementing this, these facts prevent the most common mistakes:
Context is a static class. There is no repository object to construct or register; register only the IDbProvider (once) and your configuration factory.
- Build a new
Configuration per request. Take CurrentUserId from the authenticated principal, never from the request body, a header or a query string.
AccessMode defaults to ViewOnly: a configuration that sets nothing can change nothing.
- The endpoint returns the string from
Context.GetResponse unchanged, with content type application/json. Read the request body as a raw string; do not model-bind it. Catch RepositoryPermissionException before RepositoryException, and return ResponseJson from both with status 200.
- The libraries never create or alter the database. Run
00001.Database.sql (and later numbered scripts) yourself; Context.CheckDatabase only checks.
Context.SyncSources is the only way source objects enter RR. Users cannot create them. Call it before anyone writes a rule.
- The browser needs both script files (
codeeffects.editor.js and codeeffects.repository.js, in any order, both type="module") and both packages' stylesheets. $repo is not a global: read CodeEffects.Rule.Repository or import $repo.
- AI agents and services never make versions live, approve or delete, whatever permissions you grant; their saves always request approval.
- The MCP server requires ASP.NET Core on .NET 8+ and the host's own OAuth; it takes no credential in its tools.