# refactor: restructure .cursor directory for improved organization and clarity ## Description This PR refactors the `.cursor` directory to enhance organization, clarity, and maintainability. ### Problem The existing `.cursor` directory lacked clear organization, making it difficult to find specific files, understand their purpose, and add new components consistently. ### Solution A comprehensive restructuring: #### New Directory Structure ``` .cursor/ ├── settings.json # Main configuration file ├── docs/ # Documentation │ ├── guides/ # In-depth guides │ ├── references/ # Quick references │ └── practices/ # Best practices ├── rules/ # Rule definitions │ ├── commit/ # Commit-related rules │ ├── quality/ # Code quality rules │ ├── testing/ # Testing rules │ └── verification/ # Verification rules └── hooks/ # Git hooks and scripts ``` #### Key Changes 1. **Logical Categorization**: Organized files into clear categories based on purpose 2. **Improved Documentation**: Added comprehensive README files for each directory 3. **Standardized Naming**: Implemented consistent kebab-case naming convention 4. **Reference Updates**: Updated all internal references to point to new file locations ### Benefits - **Easier Navigation**: Clear categorization makes finding files intuitive - **Improved Understanding**: Comprehensive documentation explains purpose and usage - **Simplified Maintenance**: Logical structure makes updates and additions easier - **Better Onboarding**: New team members can quickly understand the system This refactoring sets a solid foundation for all Cursor AI-related configurations and rules, making it easier for the team to leverage Cursor's capabilities.
7.0 KiB
Appsmith Codebase Map
This document provides a comprehensive overview of the Appsmith codebase structure to help Cursor AI better understand the organization and relationships between different components.
Project Overview
Appsmith is a low-code platform that allows developers to build internal tools and dashboards by connecting to databases, APIs, and other data sources. The application consists of:
- A React-based frontend (client)
- A Java Spring Boot backend (server)
- Various plugins for connecting to external data sources
- A self-contained deployment architecture
Directory Structure
The codebase is organized into the following main directories:
app/- Contains the main application codeclient/- Frontend application (React)server/- Backend application (Java Spring Boot)util/- Shared utilitiesmonitoring/- Monitoring and metrics
Frontend Architecture (app/client)
The frontend is built with React, Redux, and TypeScript. Key directories include:
Core Structure (app/client/src)
actions/- Redux actionsreducers/- Redux reducerssagas/- Redux sagas for side effects and async operationsselectors/- Redux selectorsstore.ts- Redux store configuration
UI Components
components/- Reusable UI componentspages/- Page-level componentswidgets/- Draggable widgets for the page buildertheme/- Styling and theme definitionsicons/- SVG icons and icon components
Data and APIs
api/- API client and service functionsconstants/- Application constants and configurationutils/- Utility functionsentities/- Data models and entity definitions
Edition-specific Code
ee/- Enterprise Edition specific codece/- Community Edition specific code
Testing
test/- Test utilities and mockscypress/- End-to-end testing with Cypress
Backend Architecture (app/server)
The backend is built with Java Spring Boot and MongoDB. Key packages include:
Core Structure (app/server/appsmith-server/src/main/java/com/appsmith/server)
ServerApplication.java- Main application entry point
API Layer
controllers/- REST API controllersdtos/- Data Transfer Objectsexceptions/- Custom exception classes
Business Logic
services/- Business logic and service implementationshelpers/- Helper classes and utilitiesdomains/- Domain models
Data Access
repositories/- Data access repositoriesconfigurations/- Database and application configuration
Features
applications/- Application managementpages/- Page managementactions/- Action management (API, DB queries)plugins/- Plugin system for external integrationsdatasources/- Data source managementauthentication/- Authentication and authorizationorganization/- Organization management
Extensions
appsmith-plugins/- Plugin implementationsappsmith-git/- Git integration featuresappsmith-interfaces/- Core interfacesappsmith-ai/- AI features implementation
Key Concepts
Frontend Concepts
- Widgets: Draggable UI components that users can place on their pages
- Actions: API calls, DB queries, or JS code that widgets can trigger
- Datasources: Connections to external data sources like databases or APIs
- Pages: Containers for widgets representing different views in an application
- Theme: Visual styling applied to the entire application
Backend Concepts
- Applications: Container for pages and other resources
- Organizations: Groups of users and applications
- Plugins: Connectors to external services
- Actions: Executable code blocks (API calls, DB queries)
- Datasources: Connection configurations for external data systems
Code Patterns
Frontend Patterns
-
Redux for State Management:
- Actions define state changes
- Reducers implement state updates
- Sagas handle side effects
- Selectors extract state
-
Component Structure:
- Functional components with hooks
- Container/Presentation separation
- Styled-components for styling
- Typescript interfaces for type safety
-
API Communication:
- Axios-based API clients
- Redux sagas for async operations
- Error handling middleware
Backend Patterns
-
Spring Boot Architecture:
- Controller -> Service -> Repository pattern
- DTO pattern for API requests/responses
- Reactive programming with Reactor
-
Security:
- JWT-based authentication
- RBAC (Role-Based Access Control)
- Permission checks with Spring Security
-
Database:
- MongoDB as primary datastore
- Reactive repositories
Common Workflows
Frontend Development Workflow
- Define Redux actions in
actions/ - Implement reducers in
reducers/ - Create sagas for async operations in
sagas/ - Build UI components in
components/orpages/ - Connect components to Redux using selectors
Backend Development Workflow
- Define DTOs in
dtos/ - Create domain models in
domains/ - Implement repositories in
repositories/ - Add business logic in
services/ - Expose APIs in
controllers/
Testing Approach
Frontend Testing
- Unit tests with Jest and React Testing Library
- End-to-end tests with Cypress
- Visual regression tests
Backend Testing
- Unit tests with JUnit
- Integration tests with Spring Boot Test
- API tests with RestAssured
Performance Considerations
Frontend Performance
- Memoization of heavy computations
- Code splitting for page loads
- Virtualization for large lists
- Optimized rendering with React.memo
Backend Performance
- Query optimization in MongoDB
- Caching strategies
- Reactive programming for non-blocking operations
Security Model
- Authentication: JWT-based auth with refresh tokens
- Authorization: RBAC with granular permissions
- Data Isolation: Multi-tenancy support
Enterprise vs Community Edition
The codebase is separated into:
ee/- Enterprise featuresce/- Community features
Key differences:
- Enterprise: SSO, audit logs, role-based access
- Community: Basic features, self-hosted option
Important Files
Frontend
client/src/index.tsx- Application entry pointclient/src/store.ts- Redux store configurationclient/src/App.tsx- Main application component
Backend
server/appsmith-server/src/main/java/com/appsmith/server/ServerApplication.java- Main entry pointserver/appsmith-server/src/main/resources/application.yml- Application configuration
Development Guidelines
- Follow the established patterns in the existing codebase
- Use TypeScript interfaces for type safety in frontend
- Add appropriate tests for all new features
- Document complex logic with comments
- Use reactive programming patterns in backend
- Follow established file naming conventions
This map should help Cursor better understand the Appsmith codebase structure and provide more contextual assistance when working with the code.