Files
imphnen-backend-service/shell.nix
T
maulanasdqnandClaude Sonnet 4.6 e432a1a743 refactor: migrate to clean architecture with trait-based DI (v0.2.0)
Complete architectural overhaul across all 12 crates:

- Replace validator crate with zod-rs for all DTO validation
- Replace manual pagination with paginator-rs/paginator-sea-orm
- Migrate all modules (iam, cms, gacha, dimentorin) to clean architecture:
  domain → application → infrastructure layers
- Introduce trait-based DI (Arc<dyn Trait>) at every layer for repositories and services
- Delete all v1/ legacy SurrealDB-era code across every crate
- Replace opaque response helpers with typed IntoResponse structs (ApiSuccess, ApiCreated, ApiPaginated, ApiMessage)
- Remove dual_mode_repository, migration_validation_errors, validator.rs dead code
- Zero cargo clippy warnings; release build clean

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 13:39:52 +07:00

80 lines
2.3 KiB
Nix

{
pkgs ? import <nixpkgs> { },
}:
pkgs.mkShell {
inputsFrom = [ (pkgs.callPackage ./default.nix { }) ];
buildInputs = with pkgs; [
rust-analyzer
rustfmt
crate2nix
clippy
postgresql
(writeScriptBin "helpme" ''
__usage="
👋 Welcome to IMPHNEN Backend Service development environment. 🚀
If you see this message, it means your are inside the Nix shell ❄️.
[Info]===============================================================>
Rustc Version: v${rustc.version}
Rustup Version: v${rustup.version}
Cargo Version: v${cargo.version}
Command available:
- start: start project in production 🛹 ( need to run build first )
- build: build project for production
- dev: start project in development
- start-docker: start project in docker container ( compose )
- build-docker: build project for docker container
- helpme: show this messages
Repository:
- https://github.com/IMPHNEN/imphnen-cms-api
[Info]===============================================================>
"
echo "$__usage"
'')
(writeScriptBin "dev" ''
cargo watch -x run
'')
(writeScriptBin "start" ''
echo "Starting project in production mode..."
echo "Najm Course API started on port $PORT 🛹..."
./result/bin/imphnen-cms-api
'')
(writeScriptBin "build" ''
echo "Building project..."
crate2nix generate
nix build -f Cargo.nix
echo "Now you can start the project with the command 'start'"
'')
(writeScriptBin "start-docker" ''
echo "Starting project in docker container..."
docker compose up -d
'')
(writeScriptBin "build-docker" ''
echo "Building project with docker..."
docker build -t imphnen-api:latest .
echo "Project built successfully."
echo "Now you can start the project with the command 'start-docker'"
'')
];
shellHook = ''
helpme
if [ -f .env ]; then
echo "Loading .env file..."
export $(cat .env | xargs)
echo "Successfully applied .env file."
else
echo ".env file not found."
fi
'';
}