Issue Tracker App
In the previous chapter, we built a Project Planner, a multi-project kanban where anyone with the URL could create projects, add tasks, and move them between columns. It worked, but it had no concept of a user. Anyone could do anything to anyone’s data.
In this chapter, we will rebuild the Project Planner into an Issue Tracker. It is the same kanban board, but now it has users and rules about who can do what. We will add authentication (sign in with GitHub) and authorization (rules enforced on the backend about who can change which data), then mirror those rules in the UI, so a control the user is not allowed to use is not shown at all.
Getting Started
Go to the issue-tracker repository and click “Use this template” → “Create a new repository” to create your own copy.
Clone your repository to your computer:
git clone <your-repo-url> issue-tracker
cd issue-tracker
code .
The starter is the completed Project Planner from the previous chapter, renamed throughout. “Project Planner” is now “Issue Tracker,” and the tasks table is now issues. Everything still works exactly as it did at the end of last chapter. By the end of this chapter, the UI will look about the same, but there will be a lot of new rules behind it.
If you get stuck at any point, you can view the complete solution on the master branch of the original repository.
Learning Outcomes
- Distinguish authentication from authorization and know where each belongs in a full-stack app
- Add GitHub OAuth sign-in with Convex Auth and gate UI by auth state
- Read the signed-in user’s identity on the server and use it to record ownership of created data
- Write and reuse backend guards that enforce ownership and state-based authorization rules, including cross-table checks
- Mirror backend authorization rules in the UI so disallowed actions are hidden rather than just rejected
- Deploy an app with working authentication to production
Sections
- Set Up the Starter App
- Authentication vs Authorization
- Install and Configure Convex Auth
- Complete the Convex Auth Setup
- Set Up a GitHub OAuth App
- Build the Sign-In Flow
- The Current User on the Server
- Display the User in the Header
- Record Ownership When Creating Projects and Issues
- Update the Seed Script
- Hide Create Buttons from Unauthenticated Users
- Authorize Project Deletion
- Authorize Issue Edit and Delete
- Build the Edit Dialog
- Wire the Edit Dialog to the Dropdown Menu
- Authorize Status Changes
- Hide Move Items From Non-Owners
- Reflect Rules in Drag-and-Drop
- Deploy with Auth
- Practice Questions