Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/danielitoCode/AlejoTaller/llms.txt

Use this file to discover all available pages before exploring further.

Appwrite is the primary backend for AlejoTaller. It provides authentication (email/password and Google OAuth), a NoSQL database for products, categories, and sales, object storage for product images, and Cloud Functions for privileged server-side operations. Both the Android apps and the Svelte web client connect to the same Appwrite project using their respective SDKs — the Appwrite Kotlin SDK on Android and the Appwrite Web SDK on the web.

Prerequisites

  • A running Appwrite instance. You can use Appwrite Cloud for a managed setup or self-host Appwrite on a VPS or Docker environment.
  • Admin access to the Appwrite console.
  • The AlejoTaller monorepo cloned locally.

Setup Steps

1
Create a new Appwrite project
2
In the Appwrite console, click Create Project. Give it a descriptive name (e.g. AlejoTaller) and note the Project ID that is generated — you will need it for VITE_APPWRITE_PROJECT_ID (web) and APPWRITE_PROJECT_ID (Android local.properties).
3
Add your web platform:
4
  • Inside the project, go to Platforms → Add Platform → Web.
  • Enter your web hostname (e.g. alejotaller.onrender.com for production and localhost for development).
  • 5
    Add your Android platforms:
    6
  • Go to Platforms → Add Platform → Android.
  • Enter the application ID com.elitec.alejotaller for the client app.
  • Repeat for the operator app with com.elitec.alejotallerscan.
  • 7
    Enable authentication methods
    8
  • Navigate to Auth → Settings.
  • Enable Email/Password authentication.
  • Enable Google OAuth2:
    • Obtain a Web Client ID and Android Client ID from the Google Cloud Console and enter them in the Appwrite OAuth provider settings.
    • Copy the Web Client ID to VITE_GOOGLE_CLIENT_ID (web) and to GOOGLE_CLOUD_WEBCLIENT, GOOGLE_CLOUD_ANDROID_DEBUG, and GOOGLE_CLOUD_ANDROID_RELEASE in local.properties.
  • Optionally configure a Password Recovery redirect URL matching VITE_PASSWORD_RESET_URL.
  • 9
    Create the database
    10
  • Go to Databases → Create Database.
  • Choose a memorable name (e.g. alejo_taller_db) and note the Database ID.
  • Copy this ID to VITE_APPWRITE_DATABASE_ID (web) and APPWRITE_DATABASE_ID (Android).
  • 11
    Create collections
    12
    Create the following three collections inside your database. Enable Document Security on each collection so that read/write rules can be applied at the document level.
    13
    categories collection
    14
    Maps to the Category domain entity.
    15
    AttributeTypeRequiredNotesnameString✅Display name of the category.descriptionString✅Short description shown in the catalog.photoUrlString⬜URL of the category image (may be null).statusString✅Enum value: active or inactive.
    16
    Copy the generated Collection ID to CATEGORY_TABLE_ID in local.properties.
    17
    products collection
    18
    Maps to the Product domain entity.
    19
    AttributeTypeRequiredNotesnameString✅Product display name.descriptionString✅Full product description.existenceInteger✅Current stock count.priceFloat✅Unit price (must be ≥ 0).photoUrlString✅URL pointing to the product image in Appwrite Storage.categoryIdString✅ID referencing the parent category document.ratingFloat⬜Average customer rating, defaults to 0.0.createdAtIsoString⬜ISO 8601 creation timestamp.
    20
    Copy the generated Collection ID to PRODUCT_TABLE_ID in local.properties.
    21
    sales collection
    22
    Maps to the Sale domain entity and drives the sale verification flow.
    23
    AttributeTypeRequiredNotesdateString✅ISO 8601 sale date.amountFloat✅Total sale amount.verifiedString✅Enum: UNVERIFIED, VERIFIED, or DELETED.productsString✅JSON-serialized array of SaleItem objects (productId, productName, quantity, price).currencyString✅Enum: CUP, USD, or MLC.userIdString✅Appwrite user ID of the purchasing customer.deliveryTypeString⬜Enum: PICKUP or DELIVERY.deliveryAddressString⬜JSON-serialized DeliveryAddress object (province, municipality, streets, phone, etc.).
    24
    Enable Realtime on the sales collection (Appwrite console → collection → Settings → Realtime). The operator Android app (alejotallerscan) subscribes to Appwrite Realtime to detect when verified changes so it can trigger the publisher microservice and push the confirmation to Pusher.
    25
    Copy the generated Collection ID to SALE_TABLE_ID in local.properties.
    26
    Create the storage bucket
    27
  • Go to Storage → Create Bucket.
  • Name it (e.g. product-images) and configure permissions so authenticated users can read files.
  • Note the Bucket ID and copy it to VITE_APPWRITE_STORAGE_BUCKET_ID (web) and APPWRITE_BUCKECT_ID (Android).
  • 28
    Deploy the user-management Cloud Function
    29
    AlejoTaller uses an Appwrite Cloud Function (VITE_APPWRITE_USERS_FUNCTION) for privileged user-management operations that cannot safely run from the frontend — for example, listing or deleting users from the admin dashboard.
    30
  • In the Appwrite console, go to Functions → Create Function.
  • Select a Node.js runtime and deploy your function code.
  • Copy the generated Function ID to VITE_APPWRITE_USERS_FUNCTION in the web .env.
  • 31
    The exact function implementation lives outside the main monorepo. Refer to the admin dashboard repository at github.com/danielitoCode/dash_alejo_taller for the function source.
    32
    Copy all IDs to environment files
    33
    Once every resource is created, populate the relevant env files:
    34
    web/.env
    35
    VITE_APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
    VITE_APPWRITE_PROJECT_ID=<your-project-id>
    VITE_APPWRITE_DATABASE_ID=<your-database-id>
    VITE_APPWRITE_STORAGE_BUCKET_ID=<your-bucket-id>
    VITE_APPWRITE_USERS_FUNCTION=<your-function-id>
    VITE_APPWRITE_CONSOLE_URL=https://cloud.appwrite.io/console/project-<your-project-id>
    
    36
    local.properties (Android root)
    37
    APPWRITE_PROJECT_ENDPOINT=https://cloud.appwrite.io/v1
    APPWRITE_PROJECT_ID=<your-project-id>
    APPWRITE_DATABASE_ID=<your-database-id>
    APPWRITE_BUCKECT_ID=<your-bucket-id>
    CATEGORY_TABLE_ID=<your-categories-collection-id>
    PRODUCT_TABLE_ID=<your-products-collection-id>
    SALE_TABLE_ID=<your-sales-collection-id>
    APPWRITE_TELEGRAM_FUNCTION_URL=<your-telegram-function-url>
    

    Collection Permissions Reference

    Appwrite uses role-based permissions at both the collection and document level. A recommended starting configuration for AlejoTaller:
    CollectionReadCreateUpdateDelete
    categoriesAnyTeam (admins)Team (admins)Team (admins)
    productsAnyTeam (admins)Team (admins)Team (admins)
    salesUsers (owner only)UsersTeam (operators)Team (admins)
    Do not grant public write access to the sales collection. Each sale document should only be writable by the authenticated user who created it and by operator-role accounts.

    For the full list of environment variables that reference these IDs, see the Environment Variables Reference.

    Build docs developers (and LLMs) love