No description
backend | ||
frontend | ||
.gitignore | ||
LICENSE.md | ||
README.md |
Sharenet
A full-stack application for managing users and products, built with Rust and Next.js.
Project Overview
Sharenet is a modern web application that demonstrates clean architecture principles and provides multiple interfaces for data management:
- Web Interface: Modern React-based UI with Next.js
- API: RESTful HTTP API built with Rust and Axum
- CLI: Command-line interface for automation
- TUI: Text-based user interface for terminal users
Tech Stack
Backend
- Language: Rust
- Framework: Axum (HTTP), Clap (CLI), Ratatui (TUI)
- Database: PostgreSQL (with in-memory option)
- Architecture: Clean Architecture with domain-driven design
Frontend
- Framework: Next.js 15.3.3
- Language: TypeScript
- UI Library: React 19
- Styling: Tailwind CSS with shadcn/ui components
- Form Handling: React Hook Form with Zod validation
Quick Start
Prerequisites
- Rust (latest stable)
- Node.js (latest LTS)
- PostgreSQL (optional, in-memory storage available)
- SQLx CLI (for database migrations)
Installation
- Clone the repository:
git clone git@git.gcdo.org:devteam/sharenet.git
cd sharenet
- Set up the backend:
# Install SQLx CLI
cargo install sqlx-cli
# Create and set up the database (if using PostgreSQL)
sqlx database create
sqlx migrate run
# Build the backend
cd backend
cargo build
- Set up the frontend:
cd frontend
npm install
Running the Application
- Start the backend (choose one):
# API with in-memory storage
cargo run --bin sharenet-api-memory
# API with PostgreSQL
cargo run --bin sharenet-api-postgres
# CLI with in-memory storage
cargo run --bin sharenet-cli-memory
# TUI with in-memory storage
cargo run --bin sharenet-tui-memory
- Start the frontend:
cd frontend
npm run dev
The web interface will be available at http://localhost:3000
.
Project Structure
sharenet/
├── backend/ # Rust backend
│ ├── crates/ # Backend modules
│ ├── migrations/ # Database migrations
│ └── config/ # Configuration files
├── frontend/ # Next.js frontend
│ ├── src/ # Source code
│ └── public/ # Static assets
└── LICENSE.md # Project license
Features
User Management
- Create, read, update, and delete users
- User authentication (coming soon)
- Role-based access control (coming soon)
Product Management
- Create, read, update, and delete products
- Product categorization (coming soon)
- Inventory tracking (coming soon)
Multiple Interfaces
- Web UI for general users
- REST API for integration
- CLI for automation
- TUI for terminal users
Development
Backend Development
See backend/README.md for detailed backend development instructions.
Frontend Development
See frontend/README.md for detailed frontend development instructions.
Configuration
Backend Configuration
Configuration files are located in backend/config/
:
api-memory.env
- API server with in-memory storageapi-postgres.env
- API server with PostgreSQL storagecli-memory.env
- CLI with in-memory storagecli-postgres.env
- CLI with PostgreSQL storagetui-memory.env
- TUI with in-memory storagetui-postgres.env
- TUI with PostgreSQL storage
Frontend Configuration
The frontend is configured to connect to the backend at http://127.0.0.1:3000
by default. Update frontend/src/lib/api.ts
if your backend is running on a different address.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.