https://github.com/crisfeim/hummingbird-minimal-auth-example
🌐 A minimal Swift backend example for user registration, login, and authenticated data access using JWT tokens.
https://github.com/crisfeim/hummingbird-minimal-auth-example
Last synced: 12 months ago
JSON representation
🌐 A minimal Swift backend example for user registration, login, and authenticated data access using JWT tokens.
- Host: GitHub
- URL: https://github.com/crisfeim/hummingbird-minimal-auth-example
- Owner: crisfeim
- License: mit
- Created: 2025-06-21T01:22:10.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-06-27T10:46:38.000Z (12 months ago)
- Last Synced: 2025-06-27T11:36:56.438Z (12 months ago)
- Language: Swift
- Homepage:
- Size: 142 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MinimalAuthExample
A minimal Swift backend example for user registration, login, and authenticated data access using JWT tokens.
For the sake of simplicity, a file store has been used for data persistency.
This project was built to learn the basics of backend development and JWT authentication in Swift, using [Hummingbird](https://github.com/hummingbird-project/hummingbird) and [JWTKit](https://github.com/vapor/jwt-kit).
## Features
- ✅ User registration with hashed passwords (using Bcrypt)
- ✅ User login with password verification
- ✅ JWT-based authentication
- ✅ Create and retrieve user-specific recipes
- ✅ Tested use cases and HTTP endpoints
## Endpoints
- `POST /register`: Register a new user (returns JWT token)
- `POST /login`: Authenticate a user (returns JWT token)
- `POST /recipes`: Create a recipe (requires Bearer token)
- `GET /recipes`: Fetch recipes for authenticated user
## Notes
- For simplicity, the project uses dependency injection via function closures (not protocols).
- JSON files are stored in a custom path using `.cachesDirectory`.
## License
MIT