--- title: 'Project documentation template' disqus: hackmd --- Teritori-dapp Codebase Review Report === ## Table of Contents [TOC] ## Introduction Hello, team! I'm [Chibuzor Daniel Uwezukwe](https://www.linkedin.com/in/chibuzoruwezukwe/), an experienced developer with a passion for building innovative software solutions. I've worked extensively with Go, Cosmos SDK, and JavaScript (Node.js & React.js). Excited to expand my skills in React Native and gnolang, I'm looking forward to contributing to this project and collaborating with all of you. ## Teritori-dapp ![teritori](https://hackmd.io/_uploads/H1R0vktr6.png) Teritori, built with Cosmos SDK, is more than just an all-in-one communication app. It's your gateway to a decentralized future, where you can chat privately, play P2P, manage your NFT collection, and even govern the platform itself. Stake your $TORI tokens, build your on-chain profile, and experience the "Genesis Era" with an NFT marketplace, social feed, and more. Soon, Teritori will evolve into a haven for privacy-first messaging and local, internet-free connections. But Teritori isn't just about using cool features, it's about owning them. Vote on upcoming launches, features, and even bounties, becoming a true stakeholder in the Teritori ecosystem. This community-driven project, bootstrapped by a dedicated team, welcomes external builders and contributors with open arms. Grants and bounties are just the beginning. So, explore Teritori's dApp, join the [Discord](https://discord.gg/teritori), and help shape the future of communication, coordination, and ownership. 🚀 Environment Setup and Build --- >Environment Setup: Followed the provided [instructions](https://github.com/TERITORI/teritori-dapp#readme) for environment setup. ``` >README.md Tested environment yarn --version 3.5.0 node --version v18.1.0 npx --version 8.15.0 If you have trouble, try to match these versions Dev for web yarn && npx expo start Then press w to open the page in your browser Build web app yarn && npx expo-optimize && npx expo export:web The site is in web-build/ ``` >Built & deployed the application locally at http://localhost:19006. Screenshots are included below for your reference. ![Screenshot 2023-12-02 at 17.55.42](https://hackmd.io/_uploads/r1Ts-yKST.png) ![Screenshot 2023-12-02 at 17.51.28](https://hackmd.io/_uploads/ByspWktBa.png) ![Screenshot 2023-12-02 at 17.52.00](https://hackmd.io/_uploads/HyoTZJKr6.png) >Issues Faced: No issues was faced during the set up Code Base Exploration --- My initial exploration of the Teritori codebase has been both illuminating and exciting. The sheer ambition to integrate features like P2P communication, NFT marketplaces, and on-chain governance into one app is truly impressive. The Cosmos SDK and Berty protocol choices seem well-suited for this endeavor, fostering a secure and scalable foundation. >Architecture Overview: The overall architecture appears well-organized and modular, leveraging components like the Teritori Chain and separate modules for specific functionalities like the NFT marketplace and social feed. This modularity allows for independent development and maintenance, potentially facilitating future contributions from the community. **Key Modules and Dependencies:** Several key modules immediately grabbed my attention: * Cosmos SDK: This robust framework provides a solid foundation for blockchain integration, enabling features like staking and governance. * Berty Protocol: Its focus on privacy-first messaging perfectly aligns with Teritori's vision of secure communication without relying on centralized servers. * mDNS and BLE: The implementation of these technologies for local P2P connections shows an innovative approach to tackling internet connectivity limitations. **Initial Observations:** * Documentation: The existing documentation provided a good starting point. * Coding Style: Overall, the codebase adhered to consistent formatting and conventions, making it easier to navigate and understand. * Testing: I found it challenging to locate and run unit tests and integration tests. Having readily accessible and comprehensive tests would significantly enhance the onboarding experience for new developers. **Product Feedback for Teritori dApp (Alpha)** >As a newcomer diving into the Teritori dApp, I'm blown away by its ambition and potential. It's like having a futuristic communication hub in my pocket, blending P2P messaging, NFT marketplaces, and on-chain governance into one seamless experience. However, as with any alpha version, there's room for refinement and exciting additions. **General Impressions:** * Intuitive UI: The interface is clean and user-friendly, making it easy to navigate. Kudos for the clear labeling and logical information flow! * Feature Powerhouse: The sheer range of features in this alpha version is impressive. From staking and NFT minting to social feeds and P2P connections, Teritori feels like a *one-stop shop for all things Web3 communication and interaction*. * Community Focus: Integrating on-chain governance and voting mechanisms right from the start is a brilliant move. It empowers users to become real stakeholders in shaping Teritori's future, fostering a strong sense of community ownership. **Suggested Enhancements:** * Light Mode: While I appreciate the dark mode aesthetic, offering a light mode option would cater to users who prefer a brighter interface, especially during daytime use. * Video Tutorials: While the documentation is helpful, I believe adding a library of short, engaging video tutorials would be a game-changer for onboarding new users. Imagine quick demos showcasing how to mint an NFT, participate in governance, or connect with friends P2P – it would significantly lower the barrier to entry and attract a wider audience. Overall, I'm incredibly excited about Teritori's potential to revolutionize how we communicate and interact in the digital world. By incorporating these suggestions and continuing to prioritize user experience and community involvement, Teritori can truly become the go-to platform for the decentralized future. > Example: The teritori-dapp repository encompasses various [networks](https://github.com/TERITORI/teritori-dapp/tree/main/packages/networks), including decentralized platforms Ethereum. These networks are crucial components of the TERITORI decentralized application (DApp) ecosystem. The networks directory contains configurations and implementations tailored to support decentralized functionalities Explore the diverse set of networks within the repository to understand how TERITORI utilizes these frameworks to create a robust and secure decentralized environment. ``` export const ethereumNetwork: NetworkInfo = { id: "ethereum", kind: NetworkKind.Ethereum, displayName: "Ethereum", icon: "icons/networks/ethereum.svg", features: [NetworkFeature.NFTMarketplace, NetworkFeature.NFTLaunchpad], currencies: ethereumCurrencies, idPrefix: "eth", endpoint: "https://ethereum.publicnode.com", txExplorer: "https://etherscan.io/tx/$hash", accountExplorer: "https://etherscan.io/address/$address", contractExplorer: "https://etherscan.io/address/$address", testnet: false, backendEndpoint: "https://dapp-backend.mainnet.teritori.com", chainId: 1, alchemyApiKey: "xZ3FVF0o6q_4beg_afmCEzf4GSJErhId", theGraphEndpoint: "https://api.studio.thegraph.com/query/40379/teritori-mainnet/v1", vaultContractAddress: "0x6251B3384c8eD53e2Cc38d34c1f26ffE8d461B94", riotContractAddress: "0x8f8304ea566affeb96ad0ffb593bbebd8876d124", }; ``` >The code exports an object named ethereumNetwork, representing configuration details for the Ethereum network within the TERITORI decentralized application. It includes information such as the network's unique identifier, type, display name, icon path, supported features (like NFT Marketplace and NFT Launchpad), endpoint URL for the Ethereum node, Etherscan URLs for exploring transactions, accounts, and contracts, and other network-specific parameters. This configuration facilitates seamless interaction between the TERITORI DApp and the Ethereum blockchain, covering mainnet settings with specific contract addresses and API keys for services like Alchemy and The Graph. Features --- Teritori is a multifaceted dApp that offers a diverse range of features, including a social feed, marketplace, launchpad, name service, wallet, dashboard, staking, governance, multisigs, Osmosis Dex, R!ot game, Toripunks dApp, and dApp store. These features cater to the needs of experienced crypto enthusiasts and newcomers alike, making Teritori a versatile platform for exploring the decentralized world. Folder-wise Analysis --- Here's a deeper analysis of some key areas within the [Teritori dApp codebase](https://github.com/TERITORI/teritori-dapp): *API & Functionality:* The .expo-shared and assets folders suggest a focus on optimized visuals and performance, crucial for a user-friendly dApp experience. The api folder's recent update highlights a move towards externalizing app integrations, potentially improving scalability and maintenance. The go folder, with its service.go fix, reveals ongoing backend development and refinement of core functionalities. *UI & User Experience:* The packages folder, with its latest message screen update, showcases the focus on iterating and enhancing [UI components](https://github.com/TERITORI/teritori-dapp/tree/main/packages/components). *Code Quality & Efficiency:* The presence of .editorconfig, .eslintignore, and .eslintrc.js shows a commitment to code consistency and maintainability. The depcheckrc and yarnclean folders suggest a focus on avoiding dependency bloat and keeping the project lean. The presence of metro.config.js and CI-related files in .github/workflows indicates automated testing and building, ensuring quality and continuous improvement. *Integration & Interoperability:* The buf.gen.yaml and buf.yaml folders hint at the use of Buffer Protocol, potentially enabling seamless communication with other compatible applications. The docker-compose.yml file suggests containerized infrastructure, potentially facilitating deployments across different environments. The presence of networks.json and recent updates related to RPC/REST cache usage indicate thoughtful handling of blockchain connections and data management. >The Teritori dApp codebase exhibits a well-structured and organized layout, with dedicated folders for specific functionalities and ongoing development efforts. **A Deep Dive with a Focus on Naming Conventions** Building upon the previous analysis, let's delve deeper into the fascinating world of Teritori's folder naming conventions. It's a subtle yet powerful aspect that reflects the project's values and approach. Clear and Concise: The majority of folders utilize straightforward names like api, electron, and assets. This prioritizes clarity and intuitive navigation, minimizing confusion even for newcomers. Functionality First: Names like service.go and message screen prioritize functionality over abstraction. They tell you exactly what's inside, streamlining development and collaboration. Version Control Awareness: Folders like .expo-shared and .yarnclean utilize prefixes that denote their purpose within the larger project ecosystem. This awareness of version control and dependency management is crucial for a complex dApp. Future-Proofing: Folders like networks.json and docker-compose.yml hint at broader ambitions. The use of JSON and YAML indicates an eye towards future scalability and integrations. Intriguing Exceptions: A few folders, like .svgrrc.js and buf.yaml, pique curiosity with less obvious names. They challenge us to explore further, revealing hidden depths of Teritori's technical stack and potential innovative features. >Teritori's folder naming conventions are a masterclass in balancing clarity, functionality, and future-proof design. They speak volumes about the project's dedication to user experience, collaboration, and ambitious vision. By combining practical labels with subtle hints of what's to come, these names invite exploration, inspire confidence, and ultimately contribute to Teritori's success as a user-friendly and ever-evolving dApp While the folder analysis reveals the project's structure and intentions, a closer look unveils another crucial element: TypeScript. This language extension plays a vital role in shaping Teritori's codebase, and here's why: * Type Safety: TypeScript's core strength lies in its ability to define types for variables, functions, and objects. This adds a layer of safety and predictability to the code, preventing runtime errors and improving code quality. Imagine the "message screen" component being explicitly typed, ensuring a consistent structure and avoiding unexpected data formats. * Maintainability & Collaboration: With types explicitly defined, the code becomes more self-documenting and easier to understand. Developers can readily grasp the purpose and expected behavior of different parts, facilitating collaboration and knowledge sharing. Imagine contributors confidently navigating the codebase, empowered by clear type annotations. * Refactoring Confidence: TypeScript's types act as guardrails, providing feedback during refactoring and code changes. This reduces the risk of introducing unexpected bugs and regressions, allowing developers to experiment and iterate with greater confidence. * Large Codebase Efficiency: In a complex dApp like Teritori, managing a massive codebase can be daunting. TypeScript's type system helps organize and structure the project, making it easier to navigate and maintain. Imagine folders like .eslintrc.js and declarations.d.ts working together to enforce consistent typing across the codebase. **Suggestions** >[Go folder](https://github.com/TERITORI/teritori-dapp/tree/main/go): The current description "Go code for backend functionalities" is vague and doesn't give much insight into what those functionalities actually are. A sub-README.md within the go folder could elaborate on specific services, utilities, or interfaces implemented in Go. Imagine a clear breakdown of each Go file or subfolder, explaining its purpose and how it interacts with other components. Additionally, the description could mention any relevant libraries or frameworks used in the Go code, like gRPC. This would give developers a better understanding of the technical landscape and potentially identify areas for collaboration or optimization. Other folders: Overall, sub-README.md files for specific folders could: Reduce vagueness and ambiguity. By clearly explaining the purpose and contents of each folder, developers can quickly grasp the project structure and avoid unnecessary exploration. Improve collaboration and knowledge sharing. Developers can understand how different components fit together and readily contribute to specific areas without needing to decipher cryptic folder names. Boost maintainability and future development. Clear documentation within folders allows future developers to easily onboard, understand legacy code, and make informed decisions when adding new features. By incorporating sub-README.md files, Teritori can take its codebase from good to great, fostering a more open, collaborative, and future-proof development environment. Potential improvements: --- Here are some potential feedback to fuel Teritori-dapp future evolution * Tutorial mode: Create an interactive tutorial that guides new users through the dApp's core functionalities, explaining components in a step-by-step manner. Imagine reducing friction for new users and encouraging wider adoption. * Localization support: Consider incorporating multi-language support to cater to a global audience. Imagine users interacting with Teritori in their native language, breaking down language barriers and expanding reach. * Community engagement: Create more avenues for community feedback and contributions. Imagine users suggesting new features, voting on priorities, and actively shaping the dApp's future.