Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: add initial cursor rules (#5926)

Marc Klingenf0c37c8309d1
diff --git a/.cursor/rules/authorization-and-rbac.mdc b/.cursor/rules/authorization-and-rbac.mdc
new file mode 100644
index 0000000000..2341699519
--- /dev/null
+++ b/.cursor/rules/authorization-and-rbac.mdc
@@ -0,0 +1,6 @@
+---
+description: How to manage authorization and RBAC within full-stack langfuse features
+globs: web/
+alwaysApply: true
+---
+See [README.md](mdc:web/src/features/rbac/README.md) for details
\ No newline at end of file
diff --git a/.cursor/rules/entitlements.mdc b/.cursor/rules/entitlements.mdc
new file mode 100644
index 0000000000..807ac253ef
--- /dev/null
+++ b/.cursor/rules/entitlements.mdc
@@ -0,0 +1,7 @@
+---
+description: How to enforce entitlements across full-stack features
+globs: web/**
+alwaysApply: true
+---
+
+Check [README.md](mdc:web/src/features/entitlements/README.md) to learn more about entitlements
diff --git a/.cursor/rules/frontend-features.mdc b/.cursor/rules/frontend-features.mdc
new file mode 100644
index 0000000000..4449bf3413
--- /dev/null
+++ b/.cursor/rules/frontend-features.mdc
@@ -0,0 +1,33 @@
+---
+description: How we build new full-stack features including frontend APIs, file structure, and components
+globs: web/**
+alwaysApply: true
+---
+## Framework
+
+- Next.js
+- Pages router
+
+## File Structure
+
+- We generally put all code related to a net-new feature into a folder within web/src/features.
+- Checkout other features to learn about the common structure.
+
+## API for frontend features
+
+- We use TRPC.io to power full-stack features of the Langfuse Frontend
+ - Entry point for all trpc routes: [root.ts](mdc:web/src/server/api/root.ts)
+- Authentication, see [authorization-and-rbac.mdc](mdc:.cursor/rules/authorization-and-rbac.mdc)
+- Entitlements, see [entitlements.mdc](mdc:.cursor/rules/entitlements.mdc)
+
+## Components
+
+- We use Shadcn/ui
+ - Components in `@/src/components/ui`
+ - If a component is not installed yet, ask the user to install it for you
+- When creating new custom components that generalize, we add them with a generalizable naming to `@/src/components`
+
+## Styling
+
+- We use Tailwind CSS
+- We use a standard color palette which automatically handles light/dark mode, see [globals.css](mdc:web/src/styles/globals.css)
\ No newline at end of file
diff --git a/.cursor/rules/public-api.mdc b/.cursor/rules/public-api.mdc
new file mode 100644
index 0000000000..823287d5e7
--- /dev/null
+++ b/.cursor/rules/public-api.mdc
@@ -0,0 +1,15 @@
+---
+description: How to create new public api routes for Langfuse
+globs:
+alwaysApply: false
+---
+
+# Implementation
+
+- All public api routes are in /web/src/pages/api/public
+- New api routes should follow these guidelines:
+ - Use [withMiddlewares.ts](mdc:web/src/features/public-api/server/withMiddlewares.ts) as a wrapper
+ - Define types of api request and response in /web/src/features/public-api/types
+ - Add end-to-end test, similar to [datasets-api.servertest.ts](mdc:web/src/__tests__/async/datasets-api.servertest.ts)
+ - Add fern configuration in /fern, learn more about structure here: https://buildwithfern.com/learn/api-definition/fern/overview
+ - Prompt user to regenerate the OpenAPI spec via the fern CLI
\ No newline at end of file