Skip to content

Repository files navigation

Trease - Your Focus Forest

Trease

Cultivate attention.

An open-source backend for Trease Focus
A free alternative to Forest App 🌲

TypeScript Bun GNU License




✨ Features

🎨 Procedurally Generated Flora — Every plant is unique, grown from seeds
🎬 Real-time Video Generation — Watch your trees grow with animated 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

# Start the server
bun run src/server.ts

🌱 Server listening on http://localhost:3000




📡 API Reference

Generate Image

GET /image?type={plant}&seed={seed}
Parameter Type Description
type string Plant type (see available types below)
seed int Optional. Unique seed for reproducibility(16 chars)

tree growth gif

### Generate Video
GET /video?type={plant}&seed={seed}
GET /video?type={plant}&seed={seed}

Watch your plant grow in real-time! Returns a streaming WebM video.


Get Tree Info

GET /treeInfo?seed={seed}

Returns positioning data for the tree trunk.


🌿 Available Plant Types

Type Description
tree Classic deciduous tree
sakura Japanese cherry blossom
maple Autumn maple tree
cedar Evergreen cedar
wisteria Purple cascading wisteria
weeping_willow Graceful weeping willow
sunflower Bright yellow sunflower
lavender Fragrant lavender bush
pink_balls_tree Whimsical pink spheres tree



🎨 Examples

Generate a unique Sakura tree

curl "http://localhost:3000/image?type=sakura" -o sakura.png

Generate a growing tree video

curl "http://localhost:3000/video?type=maple" -o maple.webm



🛠️ Tech Stack

Tech Stack

  • Runtime: Bun — Fast JavaScript runtime
  • Framework: BaoJS — Lightweight web framework
  • Canvas: @napi-rs/canvas — High-performance canvas rendering
  • Video: FFmpeg — Video encoding and streaming



🤝 Contributing

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

  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
  • Create frontend client
  • 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

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages