END-TO-END PROJECT: BUILD A DECENTRALIZED TODO LIST
Let us build a complete application from scratch.
PROJECT SETUP:
1. Install dfx
2. Create project: dfx new todo-app
3. Choose Motoko or Rust
4. Configure dfx.json
BACKEND CANISTER:
actor TodoApp {
stable var todos: [(Nat, Text, Bool)] = [];
stable var nextId: Nat = 0;
public func addTodo(text: Text) : async Nat {
let id = nextId;
todos := Array.append(todos, [(id, text, false)]);
nextId += 1;
return id;
};
public func completeTodo(id: Nat) : async () {
todos := Array.map(todos, func((tid, text, done)) {
if (tid == id) (tid, text, true)
else (tid, text, done)
});
};
public query func getTodos() : async [(Nat, Text, Bool)] {
return todos;
};
}
FRONTEND:
Create index.html with:
1. Input field for new todos
2. Add button
3. List of todos
4. Complete button for each
DEPLOYMENT:
1. dfx start --background
2. dfx deploy
3. Open in browser
4. Test functionality
PRODUCTION CHECKLIST:
1. Add authentication (Internet Identity)
2. Add stable memory
3. Add error handling
4. Add frontend certification
5. Deploy to mainnet
EXTENSIONS:
1. Add user accounts
2. Add categories
3. Add due dates
4. Add reminders
5. Add sharing
THIS IS THE COMPLETE ICP COURSE.
From introduction to architecture to building real applications. You now have the knowledge to build anything on the Internet Computer.
The future is decentralized. The future is ICP.
$ICP #InternetComputer #CourseComplete