Skip to content

This is the backend for TreeByte, a platform that transforms your digital footprint into real-world reforestation ๐ŸŒณ. It manages API routes, wallet logic, NFT issuance, metadata generation, and prepares future integrations with Stellar blockchain and IPFS.

Notifications You must be signed in to change notification settings

Tree-Byte-org/TreeByte-Backend

Repository files navigation

๐ŸŒฑ TreeByte Backend โ€“ The Engine Behind Reforestation Powered by Web3

This is the backend for TreeByte, a platform that transforms your digital footprint into real-world reforestation ๐ŸŒณ. It manages API routes, wallet logic, NFT issuance, metadata generation, and prepares future integrations with Stellar blockchain and IPFS.


๐Ÿงฐ Tech Stack

  • Node.js + Express
  • TypeScript
  • Stellar SDK (Testnet-ready)
  • Dotenv for environment configuration
  • Module-alias for cleaner imports

๐Ÿ“ฆ How to clone and run locally

Clone the repository:

git clone https://github.com/Tree-Byte-org/TreeByte-Backend.git
cd TreeByte-Backend

๐Ÿ” Environment Setup

  1. Duplicate the .env.example file and rename it to .env
  2. Add your Supabase credentials:
# ================================
# SERVER CONFIGURATION
# ================================
PORT=4000

# ================================
# SUPABASE CONFIGURATION
# ================================
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your_supabase_anon_key_here

# ================================
# EMAIL CONFIGURATION
# ================================
MAIL_USER=[email protected]
MAIL_PASS=your_email_password_or_app_password

# ================================
# PINATA (IPFS)
# ================================
PINATA_API_KEY=pinata_api_key
PINATA_SECRET_API_KEY=pinata_secret_api_key
PINATA_JWT=pinata_jwt

You can find these keys in your Supabase dashboard, under Project Settings โ†’ API.


๐Ÿงช Database Setup with Supabase

1. Create a Supabase Project

2. Link Your Supabase Project

npx supabase login
npx supabase link --project-ref YOUR_PROJECT_REF

Youโ€™ll be asked to enter your database password.


3. Apply Migrations

Once linked, push your SQL migrations:

npx supabase db push

This will create all tables defined in supabase/migrations/ in your Supabase project.


๐Ÿš€ Run the Backend

Development Mode

npm install
npm run dev

Production Mode

npm run start

๐Ÿ“˜ Coupon Redemption Endpoint

Route: POST /api/coupon/redeem/:id

Body JSON:

  • userId (uuid, required)
  • redemptionLocation (string, optional)
  • redemptionNotes (string, optional)
  • businessVerification (string, optional)

See src/docs/coupon-redeem-openapi.yaml for full schema and responses.


๐Ÿ“ฌ Contact & Collaborations

Want to contribute, collaborate, or learn more?

๐Ÿ“ฉ [email protected] ๐Ÿฆ @GoTreeByte (https://twitter.com/GoTreeByte)

About

This is the backend for TreeByte, a platform that transforms your digital footprint into real-world reforestation ๐ŸŒณ. It manages API routes, wallet logic, NFT issuance, metadata generation, and prepares future integrations with Stellar blockchain and IPFS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 9

Languages