Skip to content

Trease-Focus/trease-tree-compiler

Repository files navigation

Trease - Your Focus Forest

Trease

Cultivate attention.

A unified collection of procedurally generated trees for Trease Focus
Compiling all tree artwork into cacheable images and videos 🌲

TypeScript Bun GNU License




✨ Features

🌳 Tree Collection Hub — Compiles all tree artwork from various sources into one place
🎨 Procedurally Generated Flora — Every plant is unique, grown from seeds
📦 Cache Generation — Pre-generates images, videos, and entity data for efficient distribution
🎬 Video Generation — Watch your trees grow with animated growth videos




🌸 The Garden Collection

Every focus session grows something beautiful. (More to be added)


Tree
🌳 Tree
Sakura
🌸 Sakura
Maple
🍁 Maple
Cedar
🌲 Cedar
Wisteria
💜 Wisteria
Weeping Willow
🌿 Weeping Willow
Sunflower
🌻 Sunflower
Lavender
💐 Lavender
Pink Balls Tree
🩷 Pink Balls Tree



🚀 Quick Start

Prerequisites

  • Bun runtime installed
  • FFmpeg (for video generation)

Installation

# Clone the repository
git clone https://github.com/trease-focus/trease-backend.git
cd trease-backend

# Install dependencies
bun install



📦 Cache Generation

The primary purpose of this repository is to generate cached assets for all tree entities.

Generate Entity Data

Outputs metadata for all available tree types to cache/entity_data.json:

bun run cache-gen/generate_entity_data.ts

Generate Image Cache

Pre-renders all tree variants as PNG images to cache/images/:

bun run cache-gen/generate_image_cache.ts

render only a specific tree id

bun run cache-gen/generate_image_cache.ts maple

Generate Video Cache

Creates growth animation videos for all tree variants to cache/video/. Always ensure to generate image cache first as the images generated by it are used to calculate the tree anchors:

bun run cache-gen/generate_video_cache.ts
bun run cache-gen/generate_video_cache.ts maple



📡 Development Server (Optional)

For local testing, you can run the development server:

bun run src/server.ts

🌱 Server listening on http://localhost:3000

API Endpoints

Endpoint Description
GET /image?type={plant}&seed={seed} Generate a plant image
GET /video?type={plant}&seed={seed} Generate a growth video
GET /treeInfo?seed={seed} Get tree positioning data



🛠️ Tech Stack

Tech Stack

  • Runtime: Bun — Fast JavaScript runtime
  • Canvas: @napi-rs/canvas — High-performance canvas rendering
  • Video: FFmpeg — Video encoding and generation



🤝 Contributing

Contributions are what make the open-source community amazing! Any contributions you make are greatly appreciated.

NOTE: This repo only accepts tree generation done via pure code. If you are an artist and wish to contribute without prior knowledge of code, please follow this link: How to submit a artwork

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingPlant)
  3. Commit your Changes (git commit -m 'Add some AmazingPlant')
  4. Push to the Branch (git push origin feature/AmazingPlant)
  5. Open a Pull Request

🌱 Ideas for Contributions

  • Add new plant species (open an issue with an image to your art if you dont know how to code but would like to contribute)
  • Improve animation smoothness
  • Add seasonal variations
  • Add weather effects (rain, snow, wind)



📄 License

Distributed under the GNU GENERAL PUBLIC LICENSE Version 3. See LICENSE for more information.




Maple

Built with 💚 for focused minds everywhere

Stay focused. Grow forests. Change the world. 🌍


⬆️ Back to Top

About

An open-source alternative to the forest focus app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors