sharenet/README.md

147 lines
No EOL
3.7 KiB
Markdown

# 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
1. Clone the repository:
```bash
git clone git@git.gcdo.org:devteam/sharenet.git
cd sharenet
```
2. Set up the backend:
```bash
# 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
```
3. Set up the frontend:
```bash
cd frontend
npm install
```
### Running the Application
1. Start the backend (choose one):
```bash
# 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
```
2. Start the frontend:
```bash
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](backend/README.md) for detailed backend development instructions.
### Frontend Development
See [frontend/README.md](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 storage
- `api-postgres.env` - API server with PostgreSQL storage
- `cli-memory.env` - CLI with in-memory storage
- `cli-postgres.env` - CLI with PostgreSQL storage
- `tui-memory.env` - TUI with in-memory storage
- `tui-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](LICENSE.md) file for details.