Add `nx add auth` to install a reviewed account flow
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- authentication, cli
Research direction
Read examples/auth/README and inspect the files under examples/auth/src/accounts/, examples/auth/src/actions/accounts.py, and the sign up, sign in, account, and not found pages and tests. Compare the file-writing behavior requested here with issue #671, then document whether the command copies the example or wraps nexy-auth before implementation. Done means the command preserves existing files, is idempotent, prints changed files, and its generated security tests and docs meet the acceptance criteria.
Written by the indexing model from the issue text.
Description
Problem
Nexy has a working auth example in examples/auth, but a developer who wants accounts in their own project has to copy the pieces by hand and work out which ones are required for safety: signed sessions, password hashing, throttling, redirect checks, and environment settings. Copying a demo without that review can ship an unsafe login.
Proposed solution
Add nx add auth (also available as nexy add auth) that installs the account flow from the reviewed example into an existing project:
- Turn on sessions in
nexyconfig.pyand keep existing config values. - Copy the account files from
examples/auth/src/accounts/and the form actions fromexamples/auth/src/actions/accounts.pyinto the projectsrc/. - Copy the sign up, sign in, account, and not found pages, with their tests, without overwriting files the developer already owns.
- Document the required
SESSION_SECRETandSECURE_COOKIESsettings and the SQLite database location. - Keep the security behavior of the example: scrypt hashes, signed cookies, throttle, constant time comparison, and path-only redirect targets.
- Print every file changed and leave the project unchanged on a second run.
Before implementation, confirm whether the command should copy the example into the project or wrap the external nexy-auth package. The external project has open issues about module support, email and password sessions, and client adapters (NexyPy/nexy-auth issues 9, 2, and 6). The choice must be recorded in the docs.
Acceptance criteria:
- A project after
nx add authpasses the copied security tests, including forged cookies, open redirects, repeated wrong passwords, and HTML in query values. - Running the command twice produces no further changes and never overwrites an owned file.
- A docs page explains setup, environment variables, and what the command does not provide, such as email confirmation and a shared throttle store for multiple processes.
- Tests cover the generated files, config edit, conflict handling, and idempotency.
Alternative solutions
Point developers at examples/auth and ask them to copy files themselves, or make auth an external package only. Both avoid a new command but leave the safety review and the wiring to each developer.
Additional context
The command should follow the file writing behavior of nx add vercel (issue #671): data describing the generated files, no auth dependency added to the framework core, and no overwrite of a file the developer owns. The reference implementation is examples/auth/ and its README lists the security rules. Related work: issue #570 closed the auth example, and nexy-auth issues 1, 2, 6, and 9 track the external package API.
Validation
- I have searched existing issues and this is not a duplicate.
- I would be willing to help implement this feature.
- Dominant language
- Python
- Stars
- 11
- Forks
- 6
- Avg merge
- 2h 14m
- Merged PRs (30d)
- 265
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NexyPy/nexy
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area:cli difficulty:intermediate enhancement
Difficulty 2/5 Half a day Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
area:cli area:docs question
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area:docs difficulty:beginner good first issue priority:3
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
area:docs difficulty:beginner good first issue priority:3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
jxxghp/MoviePilot#7699 ·
Maintainers usually reply within 1 day
-
bug TAG: unit tests
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
learningequality/ricecooker#898 ·
-
next
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
j3ko/agent-plugins#80 ·
Maintainers usually reply within 1 day
-
bug:unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Heroic-Games-Launcher/HeroicGamesLauncher#6187 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
BCStudentSoftwareDevTeam/cas#491 ·
Maintainers usually reply within 8 days