1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# Silmataivas (Rust Version)
Silmataivas is a weather monitoring service that sends personalized alerts based on user-defined thresholds and notification preferences. This is the Rust version, providing a RESTful API for managing users, locations, weather thresholds, and notification settings.
## Features
- Weather monitoring using OpenWeatherMap API
- Custom weather thresholds per user
- Flexible notifications: NTFY (push) and SMTP (email)
- User-specific configuration
- RESTful API for all resources
## Project Structure
- **src/main.rs**: All application logic and API endpoints (no lib.rs, not a library)
- **src/**: Modules for users, locations, notifications, weather thresholds, etc.
- **migrations/**: SQL migrations for SQLite
- **Dockerfile**: For containerized deployment
## Quick Start
### Prerequisites
- Rust (see [rustup.rs](https://rustup.rs/))
- SQLite (default, or set `DATABASE_URL` for PostgreSQL)
### Running Locally
```bash
# Clone the repository
git clone https://codeberg.org/silmataivas/silmataivas.git
cd silmataivas
# Build and run
cargo build --release
./target/release/silmataivas
```
The server will listen on port 4000 by default. You can set the `DATABASE_URL` environment variable to change the database location.
### Using Docker
```bash
docker build -t silmataivas .
docker run -p 4000:4000 -e DATABASE_URL=sqlite:///data/silmataivas.db silmataivas
```
## API Usage
All API endpoints (except `/health`) require authentication using a Bearer token:
```
Authorization: Bearer <user_id>
```
See the source code for endpoint details. (OpenAPI docs are not yet auto-generated in this Rust version.)
## Migration Note
This project was previously implemented in Elixir/Phoenix. All Elixir/Phoenix code, references, and setup instructions have been removed. The project is now a Rust binary only (no library, no Elixir code).
## Development
- Format: `cargo fmt`
- Lint: `cargo clippy`
- Test: `cargo test`
## Contributing
- Use conventional commits for PRs
- See the code for module structure and API details
---
For any issues or questions, please open an issue on Codeberg.
|