Skip to content

ZPlexLabs/zplex-api

Repository files navigation

ZPlex API

zplex-api is a Spring Boot–based backend service that powers the Zplex platform.
It provides authentication, user management, and integrations with external services like PostgreSQL, Redis, and Google Drive.


🚀 Features

  • Secure authentication with JWT
  • Admin user bootstrap
  • PostgreSQL persistence
  • Redis caching
  • Configurable via environment variables

📦 Requirements

  • Java 21+
  • Maven 3.9+
  • PostgreSQL
  • Redis

⚙️ Configuration

The application is configured through environment variables and Spring Boot properties.
Below are the required parameters:

🔑 Authentication & Security

Variable Description Example
ADMIN_PASSWORD Password for the default admin account. admin123
SECRET_KEY 256-bit secret key for signing JWT tokens. supersecretkey123...

🗄 Database (PostgreSQL)

Variable Description Example
ZPLEX_DATABASE_URL Database URL without jdbc: prefix. postgresql://localhost:5432/zplex
ZPLEX_DATABASE_USERNAME Database username. zplex_user
ZPLEX_DATABASE_PASSWORD Database password. mypassword

Spring Boot Properties (auto-configured in application.properties):

spring.datasource.url=jdbc:${ZPLEX_DATABASE_URL}?sslmode=require
spring.datasource.username=${ZPLEX_DATABASE_USERNAME}
spring.datasource.password=${ZPLEX_DATABASE_PASSWORD}
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect

📂 Streaming from Google Drive

Refer to zplex-stream

Variable Description Example
ZPLEX_STREAM_HOST Public URL of your deployed zplex-stream. https://zplex-stream.**.workers.dev

⚡ Redis Cache

Variable Description Example
REDIS_HOST Redis hostname. redis
REDIS_PORT Redis port. 6379
REDIS_USERNAME Redis username. default
REDIS_PASSWORD Redis password. mypassword

▶️ Running the Application

1. Clone the repo

git clone https://github.com/<your-username>/zplex-api.git
cd zplex-api

2. Set environment variables

Create a .env file (or export vars manually):

ADMIN_PASSWORD=sirzechs
SECRET_KEY=supersecretkey256bit
ZPLEX_DATABASE_URL=postgresql://localhost:5432/zplex
ZPLEX_DATABASE_USERNAME=zplex_user
ZPLEX_DATABASE_PASSWORD=mypassword
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_USERNAME=default
REDIS_PASSWORD=mypassword
ZPLEX_STREAM_HOST=https://zplex-stream.**.workers.dev

3. Build & run

./mvnw clean package
java -jar api/target/zplex-api-1.0.0.jar --server.port=62942

🛠 Development

Run directly with Maven:

./mvnw spring-boot:run -pl api

About

REST API for zplex-web

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages