Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
env:
# Skip environment validation during CI
SKIP_ENV_VALIDATION: true
NODE_OPTIONS: --max-old-space-size=8096

steps:
- name: Checkout repository
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ yarn-error.log*
*.tsbuildinfo

# idea files
.idea
.idea

# kiro

/.kiro/specs/*
25 changes: 25 additions & 0 deletions .kiro/steering/product.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# OpenSyte Product Overview

OpenSyte is an open-source all-in-one business management software designed to streamline operations for businesses of all sizes.

## Core Features

- **Customer Relationship Management (CRM)** - Contact management, sales pipeline tracking, lead management
- **Project Management** - Task creation, Gantt/Kanban boards, resource allocation, time tracking
- **Finance & Accounting** - Invoicing, expense tracking, financial reporting, payroll management
- **Human Resources** - Employee database, performance tracking, time-off management
- **Role-Based Access Control** - Feature-level permissions, custom roles, user management
- **Workflow Automation** - Custom workflows with templates and automation capabilities

## Target Users

- Small to medium businesses looking for integrated business management
- Teams needing project management with financial tracking
- Organizations requiring role-based access control and multi-tenant support

## Key Value Propositions

- Open source alternative to expensive proprietary business software
- Integrated approach reducing need for multiple separate tools
- Customizable workflows and permissions system
- Modern web-based interface with responsive design
100 changes: 100 additions & 0 deletions .kiro/steering/structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Project Structure & Organization

## Root Directory Structure

```
opensyte/
├── .kiro/ # Kiro AI assistant configuration
├── docs/ # Documentation and guides
├── prisma/ # Database schema and migrations
│ ├── migrations/ # Database migration files
│ ├── generated/ # Generated Prisma client
│ └── schema.prisma # Main database schema
├── public/ # Static assets (icons, images)
├── src/ # Main application source code
└── start-database.sh # Local database setup script
```

## Source Code Organization (`src/`)

### App Router Structure (`src/app/`)

- `(auth)/` - Authentication pages (login, register)
- `(dashboard)/` - Main application dashboard and features
- `accept-invite/` - Organization invitation acceptance
- `api/` - API routes and endpoints

### Components (`src/components/`)

Organized by feature domains:

- `ai/` - AI-related components
- `auth/` - Authentication UI components
- `crm/` - Customer relationship management
- `dashboard/` - Dashboard layouts and widgets
- `finance/` - Financial management (invoices, expenses)
- `hr/` - Human resources management
- `invitations/` - User invitation system
- `organizations/` - Multi-tenant organization management
- `projects/` - Project management features
- `rbac/` - Role-based access control
- `settings/` - Application settings
- `shared/` - Reusable components across features
- `templates/` - Workflow templates
- `ui/` - Base UI components (Shadcn/ui)
- `workflow/` & `workflows/` - Workflow automation

### Core Infrastructure

- `hooks/` - Custom React hooks
- `lib/` - Utility functions and business logic
- `server/` - Server-side code (API, database, email)
- `trpc/` - tRPC configuration and client setup
- `types/` - TypeScript type definitions
- `styles/` - Global CSS and Tailwind configuration

## Key Architectural Patterns

### Multi-Tenant Architecture

- Organization-based data isolation
- Role-based access control (RBAC)
- Custom roles and permissions system

### Feature-Based Organization

- Components grouped by business domain
- Dedicated type definitions per feature
- Modular API routes in tRPC routers

### Database Schema Organization

- Core models: User, Organization, UserOrganization
- Feature modules: CRM, Projects, Finance, HR
- RBAC: Permissions, Roles, CustomRoles
- Workflow automation system

## File Naming Conventions

- **Components**: PascalCase (e.g., `CustomerList.tsx`)
- **Hooks**: camelCase with `use` prefix (e.g., `usePermissions.ts`)
- **Types**: camelCase files, PascalCase exports (e.g., `crm.ts` exports `Customer`)
- **API Routes**: kebab-case directories, camelCase files
- **Utilities**: camelCase (e.g., `auth-client.ts`)

## Import Path Aliases

- `~/` - Maps to `src/` directory
- `~/components` - UI components
- `~/lib` - Utility functions
- `~/hooks` - Custom hooks
- `~/types` - Type definitions
- `~/server` - Server-side code

## Configuration Files

- `components.json` - Shadcn/ui configuration
- `tsconfig.json` - TypeScript configuration with strict mode
- `eslint.config.js` - ESLint with TypeScript rules
- `prettier.config.js` - Code formatting with Tailwind plugin
- `postcss.config.js` - PostCSS with Tailwind CSS v4
73 changes: 73 additions & 0 deletions .kiro/steering/tech.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Technology Stack & Development Guide

## Core Technologies

- **Framework**: Next.js 15 with App Router
- **Runtime**: Bun (package manager and runtime)
- **Language**: TypeScript with strict configuration
- **Database**: PostgreSQL with Prisma ORM
- **Styling**: Tailwind CSS v4 with CSS variables
- **UI Components**: Shadcn/ui (New York style)
- **API**: tRPC for type-safe APIs
- **Authentication**: Better Auth with Google OAuth
- **State Management**: Jotai for client state
- **Email**: Resend for transactional emails
- **SMS**: Twilio (optional)

## Key Libraries

- **Forms**: React Hook Form with Zod validation
- **UI**: Radix UI primitives, Lucide React icons
- **Data Fetching**: TanStack Query (React Query)
- **Drag & Drop**: @dnd-kit for sortable interfaces
- **Rich Text**: Tiptap editor
- **PDF Generation**: PDF-lib and PDFKit
- **Date Handling**: date-fns
- **Charts**: Custom chart components with CSS variables

## Development Commands

```bash
# Development
bun run dev # Start dev server with Turbo
bun run dev --turbo # Explicit turbo mode

# Database
bun run db:push # Push schema changes to database
bun run db:generate # Generate Prisma client and run migrations
bun run db:migrate # Deploy migrations to production
bun run db:studio # Open Prisma Studio

# Code Quality
bun run lint # Run ESLint
bun run lint:fix # Fix ESLint issues automatically
bun run typecheck # Run TypeScript compiler check
bun run check # Run both lint and typecheck

# Formatting
bun run format:check # Check Prettier formatting
bun run format:write # Apply Prettier formatting

# Build & Deploy
bun run build # Build for production
bun run start # Start production server
bun run preview # Build and start production server

# UI Components
bun run shadcn # Add new Shadcn/ui components
```

## Environment Setup

- Copy `.env.example` to `.env`
- Required: `DATABASE_URL`, `BETTER_AUTH_SECRET`, `RESEND_API_KEY`
- Optional: Google OAuth, Twilio SMS credentials
- Use `./start-database.sh` for local PostgreSQL (Docker/Podman)

## Code Style & Conventions

- ESLint with TypeScript recommended rules
- Prettier with Tailwind CSS plugin for class sorting
- Consistent type imports with `type` keyword
- Unused variables prefixed with underscore
- CSS variables for theming (light/dark mode support)
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@
"javascriptreact",
"typescript",
"typescriptreact"
]
],
"kiroAgent.configureMCP": "Disabled",
"typescript.autoClosingTags": false
}
38 changes: 38 additions & 0 deletions docs/guides/template-packs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
### Template Packs: Export, Install, and Best Practices

This document explains how Template Packs work in OpenSyte: exporting assets, installing with preflight checks, resolving variables and integrations, and testing.

#### Export Contents

- Workflows: full graph including nodes, triggers, connections, and action sub-entities (Email, SMS, WhatsApp, Slack, Calendar). Integration IDs are converted to placeholders `{ type, key }` based on the org's `IntegrationConfig` name.
- Reports: only `template`, `filters`, and `dateRange` are exported; no generated data.
- UI Layouts: selected `OrganizationUiConfig` keys as JSON.
- RBAC: custom roles with permission names.
- Variables: definitions with type/scope/required/default.
- Seeds: minimal sanitized records using `localKey` and foreign keys expressed via local keys.

#### Installation Flow

1. Preflight checks (tRPC `templates.preflight`):
- Missing integrations and variables collected from manifest.
- Name collisions computed; a plan (merge/overwrite/prefix) is suggested.
2. Install (tRPC `templates.startInstall`):
- Creates roles, variables, reports, workflows, nodes, triggers, connections.
- Resolves integration placeholders to `IntegrationConfig.id` and creates action sub-entities.
- Applies name prefix when requested.
- Writes `TemplateInstallItem` logs for each asset.
3. Seeds are applied last, resolving `localKey` to created IDs.

#### Developer Notes

- Never export secrets (credentials/endpoints). The exporter scrubs PII and content.
- Prefer using `OrganizationUiConfig` for feature-level UI settings to allow safe export/import.
- Keep integration keys stable (e.g., `primary_smtp`) to simplify mapping.

#### Testing

- Roundtrip: export a package, then install into a clean org and verify:
- Workflows can activate, nodes/triggers exist and action entities resolve integrations.
- Reports appear and render with saved template/filters/dateRange.
- UI layouts are applied or fall back via `useUiConfig` hook.
- Use `bun run check` to ensure type and lint checks pass.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"lint:fix": "next lint --fix",
"preview": "next build && next start",
"start": "next start",
"typecheck": "tsc --noEmit",
"typecheck": "node --max-old-space-size=8096 ./node_modules/typescript/bin/tsc --noEmit",
"shadcn": "bunx --bun shadcn@latest"
},
"dependencies": {
Expand Down
Loading
Loading