SafeSend is a tiny project to make a proof of concept of a simple but amazing idea: annihilate spam, for ever.
You will need to have a local maildev server running. To do so, run:
docker run -p 1080:1080 -p 1025:1025 maildev/maildevAnd then, run the server locally:
# For the first time create a JWT secret
echo 'JWT_SECRET=yop' > .env.app.local
echo 'SMTP_CONNECTION_URL = smtp://localhost:1025' >> .env.app.local
# And install the dependencies
npm it
# Update the tests
node --run jest -- -u
# Then and later, just run the server
npm run watchTesting email knocking workflow:
# This should be rejected per domain filtering
SMTP_CONNECTION_URL=smtp://localhost:2025 node --run dev -- sendMail --recipient text@whatever.com --sender test@xmp.com --subject test --message test
# This should be rejected and send an email to ask sender to knock
SMTP_CONNECTION_URL=smtp://localhost:2025 node --run dev -- sendMail --recipient text@enigma.com --sender test@xmp.com --subject test --message test
# This should knock properly
SMTP_CONNECTION_URL=smtp://localhost:2025 node --run dev -- sendMail --recipient text+knock@enigma.com --sender test@xmp.com --subject test --message test
# This should work with the appropriate token
SMTP_CONNECTION_URL=smtp://localhost:2025 node --run dev -- sendMail --recipient text+$APPROPRIATE_TOKEN@enigma.com --sender test@xmp.com --subject test --message testYou can debug the token store anytime by running:
cat /tmp/token_store.jsonTo run the server in production:
# For the first time create a JWT secret
echo 'JWT_SECRET=$(openssl rand -base64 10)' > .env.app.production
# And install the dependencies
npm it
# Then and later, just run build and run the server
npm run build
NODE_ENV=production APP_ENV=production npm startYou can understand deeply this repository and Whook's internal by simply reading the Architecture Notes. The "See in context" links drive your directly in the concerned implementation so that you can just see the code that explains the notes.
Feel free to continue creating architecture notes and to regenerate the markdown file by running:
node --run architectureStart the server in development:
# Simple dev mode
node --run dev
# Watch mode
node --run watchCreate a new route / cron / service / provider or command:
node --run createPlay with the REPL:
node --run replGenerate the dependency injection graph (here, for the putTime handler):
node --run whook -- __inject putTime,mermaid > DEPENDENCIES.mmd;
docker run --rm -u `id -u`:`id -g` -v $(pwd):/data minlag/mermaid-cli --scale 4 -i DEPENDENCIES.mmd -o DEPENDENCIES.mmd.svg;List available commands:
## In dev mode
node --run dev -- ls
## With built files
npx whook lsGenerate API types:
node --run apitypesExecute a handler in isolation:
npx whook route --name putEcho --parameters '{"body": { "echo": "YOLO!" }}'Debug whook internals:
DEBUG=whook node --run devDebug knifecycle internals (dependency injection issues):
DEBUG=knifecycle node --run devEnigma Students