Skip to content

appwrite-community/personal-crm

Repository files navigation

🧾 Personal CRM β€” SvelteKit + Appwrite Functions

A modern personal CRM application built with SvelteKit and Appwrite Functions. Features a beautiful spreadsheet-like interface for managing contacts with real-time CRUD operations. No authentication required β€” perfect for personal use.


πŸš€ Tech Stack

  • Frontend: SvelteKit with modern CSS
  • Backend: Appwrite Functions (Node.js runtime)
  • Database: Appwrite Database
  • Deployment: Appwrite Cloud

πŸ“¦ Features

  • βœ… Spreadsheet-like interface for contact management
  • βœ… Real-time CRUD operations (Create, Read, Update, Delete)
  • βœ… Bulk editing capabilities
  • βœ… Modern responsive design with gradient backgrounds
  • βœ… No authentication required (personal use)
  • βœ… CSV import/export support

πŸ“ Project Structure

/src
β”œβ”€β”€ /routes
β”‚   β”œβ”€β”€ +page.svelte          # Main UI with spreadsheet interface
β”‚   └── +layout.js           # Layout configuration
β”œβ”€β”€ /lib
β”‚   └── appwrite.js          # Appwrite client configuration
└── app.css                  # Global styles and modern UI
/functions
└── /database-operations     # Appwrite Function for CRUD operations
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ main.js          # Function entry point
    β”‚   └── db.js            # Database operations
    └── package.json         # Function dependencies

πŸ› οΈ Appwrite Setup

1. Create Project & Database

  1. Create a project on Appwrite Console
  2. Create a Database with ID: db
  3. Create a Collection with ID: crm and these attributes:
    • name β†’ String (required, 255 chars)
    • email β†’ String (required, 255 chars)
    • phone β†’ String (optional, 50 chars)
    • notes β†’ String (optional, 1000 chars)

2. Deploy Appwrite Function

# Install Appwrite CLI
npm install -g appwrite-cli

# Login to Appwrite
appwrite login

# Deploy the function
appwrite deploy function

πŸ” Environment Setup

Frontend Environment

Create a .env file in the project root:

PUBLIC_APPWRITE_ENDPOINT=https://region.cloud.appwrite.io/v1
PUBLIC_APPWRITE_PROJECT_ID=your_project_id
PUBLIC_APPWRITE_FUNCTION_URL=https://654321.fra.appwrite.network

Function Environment

The function environment is configured automatically through the Appwrite console. Required variables:

  • CORS_ORIGIN
  • APPWRITE_DATABASE_ID=db
  • APPWRITE_COLLECTION_ID=crm

πŸ§ͺ Development

# Install dependencies
npm install

# Copy the environment template
cp .env.example .env

# Edit .env with your Appwrite project details
# Then start the development server
npm run dev

The app will be available at http://localhost:5173

Development with Functions

For local function development:

# Navigate to the function directory
cd functions/database-operations

# Install function dependencies
npm install

# Test the function locally (optional)
appwrite run functions

🌐 Deployment

Frontend Deployment

To create a production version of your app:

npm run build

You can preview the production build with npm run preview.

Deploy to any static hosting provider (Vercel, Netlify, etc.) or use Appwrite's hosting feature.

Function Deployment

Functions are deployed automatically when you run:

appwrite push function

The function will be available at your Appwrite project's function URL.


πŸ“– API Documentation

The Appwrite Function provides the following endpoints:

GET /contacts

Returns all contacts from the database.

Response:

{
  "total": 1,
  "documents": [
    {
      "$id": "contact_id",
      "name": "John Doe",
      "email": "[email protected]",
      "phone": "+1-555-0123",
      "notes": "Important client"
    }
  ]
}

PUT /contacts

Creates new contacts or updates existing ones (bulk upsert).

Request Body:

{
  "contacts": [
    {
      "name": "Jane Smith",
      "email": "[email protected]",
      "phone": "+1-555-0124",
      "notes": "New prospect"
    }
  ]
}

DELETE /contacts?id=<id>

Deletes contact by their ID in the query.

DELETE /contacts

Deletes all contacts.


🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

About

Personal CRM demo to store contact information

Resources

Code of conduct

Security policy

Stars

Watchers

Forks