├── .github └── workflows │ └── codeql.yml ├── .gitignore ├── LICENSE ├── README.md ├── SECURITY.md ├── backend ├── .gitignore ├── controllers │ ├── account.js │ ├── category.js │ ├── chart.js │ ├── family.js │ ├── transaction.js │ └── user.js ├── database │ └── database.js ├── middleware │ └── auth.js ├── models │ ├── account.js │ ├── category.js │ ├── family.js │ ├── transaction.js │ └── user.js ├── package-lock.json ├── package.json └── server.js ├── frontend ├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt └── src │ ├── App.js │ ├── App.test.js │ ├── Components │ ├── Chart.js │ ├── Common │ │ └── NavbarComponent.jsx │ ├── Finances │ │ ├── FinancesTable.jsx │ │ ├── SearchFilters.jsx │ │ ├── TableComponent.jsx │ │ └── index.js │ ├── Form │ │ ├── CreateForm.css │ │ └── CreateForm.jsx │ ├── Home │ │ ├── Features.jsx │ │ ├── Footer.jsx │ │ ├── HeroSection.jsx │ │ ├── LoginModal.jsx │ │ └── index.js │ └── PieChart.js │ ├── apis │ ├── category.js │ ├── index.js │ ├── transactions.js │ └── users.js │ ├── contexts │ └── AuthContext.jsx │ ├── index.css │ ├── index.js │ ├── pages │ ├── AccountsPage.jsx │ ├── CategoryPage.jsx │ ├── DashboardPage.jsx │ ├── FinancesPage.jsx │ ├── Homepage.jsx │ ├── NotFoundPage.jsx │ └── index.js │ ├── reportWebVitals.js │ ├── routes │ └── PrivateRoutes.jsx │ ├── setupTests.js │ ├── styles │ ├── _base.scss │ ├── pages │ │ ├── _finances.scss │ │ ├── _home.scss │ │ └── _notfound.scss │ └── styles.scss │ └── utils │ ├── chart-mock-data.js │ ├── constants.js │ ├── pie-mock-data.js │ └── table-mock-data.js ├── media ├── Architecture.png ├── Chaitanya.png ├── Daya.png ├── Gourav.png ├── Signin.png ├── Vipul.png ├── accounts.jpg ├── add-account.jpg ├── add-category.jpg ├── categories.jpg ├── create-transaction.jpg ├── dashboard.jpg ├── data-model.png ├── hackathon_video.webm ├── landing-page.png ├── register.png ├── reports.jpg └── transactions.jpg ├── screenshots.md └── userguide.md /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ "main" ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ "main" ] 20 | schedule: 21 | - cron: '44 22 * * 0' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} 27 | timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} 28 | permissions: 29 | actions: read 30 | contents: read 31 | security-events: write 32 | 33 | strategy: 34 | fail-fast: false 35 | matrix: 36 | language: [ 'javascript' ] 37 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ] 38 | # Use only 'java' to analyze code written in Java, Kotlin or both 39 | # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both 40 | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support 41 | 42 | steps: 43 | - name: Checkout repository 44 | uses: actions/checkout@v3 45 | 46 | # Initializes the CodeQL tools for scanning. 47 | - name: Initialize CodeQL 48 | uses: github/codeql-action/init@v2 49 | with: 50 | languages: ${{ matrix.language }} 51 | # If you wish to specify custom queries, you can do so here or in a config file. 52 | # By default, queries listed here will override any specified in a config file. 53 | # Prefix the list here with "+" to use these queries and those in the config file. 54 | 55 | # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs 56 | # queries: security-extended,security-and-quality 57 | 58 | 59 | # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). 60 | # If this step fails, then you should remove it and run the build manually (see below) 61 | - name: Autobuild 62 | uses: github/codeql-action/autobuild@v2 63 | 64 | # ℹ️ Command-line programs to run using the OS shell. 65 | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun 66 | 67 | # If the Autobuild fails above, remove it and uncomment the following three lines. 68 | # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. 69 | 70 | # - run: | 71 | # echo "Run, Build Application using script" 72 | # ./location_of_script_within_repo/buildscript.sh 73 | 74 | - name: Perform CodeQL Analysis 75 | uses: github/codeql-action/analyze@v2 76 | with: 77 | category: "/language:${{matrix.language}}" 78 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | frontend/node_modules 2 | backend/node_modules 3 | build/ 4 | .vscode/ 5 | .vs/ 6 | ./backend/.env 7 | package-lock.json -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Personal Finance Tracker 2 | 3 | The Personal Finance Tracker is a web-based application built with JavaScript, HTML, and CSS and node.js. It allows users to track their income and expenses, manage categories, and monitor their financial transactions. 4 | 5 | The application is designed to be simple, intuitive, and user-friendly. It provides a clean, modern, and responsive user interface that is easy to navigate and understand. It also offers a range of features to help users manage their finances effectively. 6 | 7 | # Screenshots 8 | 9 | More detailed information like [Screenshots](./screenshots.md), a [Demo Video](./media/hackathon_video.webm), a [Youtube Video](https://youtu.be/B71sPOImtVA), about the application extensive [Features](./userguide.md#features), and intutive usage can be found in the [User Guide](./userguide.md) and [Screenshots](./screenshots.md) file. 10 | 11 | # Development Details 12 | 13 | The project has been developed as a part of [Fastest Coder Hackathon](https://www.fastestcoderfirst.com/) project with extensive [usage of Github CoPilot](#github-copilot-usage). 14 | 15 | ## GitHub Copilot Usage 16 | 17 | During the development of this project, we leveraged the power of GitHub Copilot, an AI-powered code generation tool. Copilot assisted us in various aspects of the development process, providing intelligent code suggestions and automating repetitive coding tasks. Here's how we used Copilot and the benefits it provided: 18 | 19 | 1. **Code Generation:** Copilot helped us generate boilerplate code, complex algorithms, and common programming patterns. By understanding our code context, it provided accurate and contextually relevant code snippets, saving us time and effort. 20 | 21 | 2. **Enhanced Productivity:** With Copilot's assistance, we were able to accelerate our development speed and productivity. It significantly reduced the time spent on searching for documentation, researching solutions, and writing repetitive code, allowing us to focus on more critical aspects of the project. 22 | 23 | 3. **Improved Code Quality:** Copilot's suggestions were aligned with coding conventions and best practices, leading to cleaner, more maintainable code. It helped us catch potential bugs, encouraged consistent code structures, and adhered to industry-standard practices, resulting in improved code quality. 24 | 25 | 4. **Learning Resource:** Copilot served as a valuable learning tool throughout the project. By observing the code suggestions provided by Copilot, we gained insights into programming patterns, idiomatic expressions, and industry-standard practices. This allowed us to enhance our coding skills and deepen our understanding of the programming language. 26 | 27 | 5. **Documentation Assistance:** Copilot helped us generate documentation for our code. It provided accurate and contextually relevant comments, allowing us to quickly and efficiently document our code. Even in writing this readme file a lot of assitance was provided by Copilot! 28 | 29 | It's important to note that while Copilot provided significant assistance, we reviewed and validated all generated code to ensure it aligned with our project requirements and followed our coding standards. Copilot should be used as a supportive tool, complementing our expertise and judgment as developers. 30 | 31 | Overall, GitHub Copilot proved to be a valuable asset, helping us streamline our development process, improve productivity, and produce high-quality code efficiently. 32 | 33 | 34 | ## Architecure and Technical Details 35 | 36 | The project is developed using the following MERN technologies and frameworks: 37 | 38 | - Frontend: JavaScript, HTML, CSS 39 | - Backend: Node.js with Express 40 | - Database: mongoDB 41 | 42 | ![Architecture Diagram](./media/Architecture.png) 43 | 44 | The application follows a client-server architecture. The frontend is built using JavaScript, HTML, and CSS. The backend is built using Node.js with Express. The database is built using mongoDB. 45 | 46 | ## Development Team 47 | The project is developed from scratch by the team members and no code was copied from any other source. 48 | 49 | | Name | Github Handle | Role | Image | 50 | | --- | --- | --- | --- | 51 | | [Vipul Taneja](https://www.linkedin.com/in/vipultaneja) | @vipulTaneja | Team Lead | ![Vipul](./media/Vipul.png) | 52 | | [Gourav Kumar Singh](https://www.linkedin.com/in/gourav-kumar-singh-246b4621b/) | @champgourav007 | Full Stack Developer | ![Gourav](./media/Gourav.png) | 53 | | [Daya Singh](https://www.linkedin.com/in/daya-singh10/) | @dayalubana | Full Stack Developer | ![Daya](./media/Daya.png) | 54 | | [Chaitanya Gupta](https://www.linkedin.com/in/guptachaitanya/) | @Chaitanya31612 | Full Stack Developer | ![Chaitanya](./media/Chaitanya.png) | 55 | 56 | ## Data Model 57 | 58 | The application consists of the following entities: 59 | 60 | ![data model](./media/data-model.png) 61 | 62 | 1. Transaction: 63 | - ID: String or Number 64 | - Description: String 65 | - Amount: Number 66 | - Type: String (income or expense) 67 | 68 | 2. User: 69 | - ID: String or Number 70 | - Username: String 71 | - Email: String 72 | - Password: String 73 | 74 | 3. Categories: 75 | - ID: String or Number 76 | - Name: String 77 | - ParentID: String or Number (optional) 78 | 79 | 4. Accounts: 80 | - ID: String or Number 81 | - Name: String 82 | - Balance: Number 83 | - Currency: String 84 | 85 | ## Installation and Usage 86 | 87 | ### 1. Clone the repository: 88 | - Open your command-line interface (CLI) or terminal. 89 | - Navigate to the directory where you want to clone the repository using the cd command. 90 | - Once you are in the desired directory, use the git clone command followed by the repository URL. 91 | - Wait for the cloning process to complete. 92 | - You have successfully cloned the directory! 93 | 94 | ### 2. Install dependencies: 95 | 96 | #### Prerequisites 97 | Make sure you have [Node.js](https://nodejs.org) and [npm](https://www.npmjs.com) (Node Package Manager) installed on your machine. 98 | 99 | #### Steps 100 | 101 | 1. Ensure cloning process above is completed without any error. . 102 | 103 | 2. Navigate to the project's root directory in your command-line interface (CLI) or terminal. 104 | 105 | 4. Switch to folder `backend` and run the following command to install the project dependencies: 106 | ```shell 107 | npm install 108 | ``` 109 | 5. Switch to folder `frontend` and run the following command to install the project dependencies: 110 | ```shell 111 | npm install 112 | ``` 113 | 114 | ### 3. Start the API server: 115 | - create a .env file in root of `backend` folder with following entries 116 | ```shell 117 | TOKEN_KEY= 118 | MONGO_URI="" 119 | ``` 120 | - Switch to folder `backend` and run the following command to run API server 121 | ```shell 122 | npm start 123 | ``` 124 | 125 | ### 4. Start the UI server: 126 | - Switch to folder `frontend` and run the following command to run the UI server 127 | ```shell 128 | npm start 129 | ``` 130 | 131 | 132 | ### 5. Access the application in your browser at [http://localhost:3000](http://localhost:3000). 133 | 134 | 135 | ## User Guide 136 | For detailed information on how to use the Personal Finance Tracker and its various features, please refer to the [User Guide](./userguide.md) file. 137 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 5.1.x | :white_check_mark: | 11 | | 5.0.x | :x: | 12 | | 4.0.x | :white_check_mark: | 13 | | < 4.0 | :x: | 14 | 15 | ## Reporting a Vulnerability 16 | 17 | Use this section to tell people how to report a vulnerability. 18 | 19 | Tell them where to go, how often they can expect to get an update on a 20 | reported vulnerability, what to expect if the vulnerability is accepted or 21 | declined, etc. 22 | -------------------------------------------------------------------------------- /backend/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | /package-lock.json 3 | -------------------------------------------------------------------------------- /backend/controllers/account.js: -------------------------------------------------------------------------------- 1 | // create crud for account using express 2 | const express = require("express"); 3 | const router = express.Router(); 4 | const Account = require("../models/account"); 5 | const auth = require("../middleware/auth"); 6 | const jwt = require("jsonwebtoken"); 7 | var moment = require("moment"); 8 | 9 | router.post("/add", auth, (req, res) => { 10 | const { name, balance, currency, parentId, familyId } = req.body; 11 | const token = req.header("Authorization"); 12 | console.log(token); 13 | const decoded = jwt.verify(token, process.env.TOKEN_KEY); 14 | const date = new Date(); 15 | const account = new Account({ 16 | name: name, 17 | userId: decoded.userId, 18 | familyId: familyId, 19 | createdBy: decoded.email, 20 | createdDate: moment(), 21 | parentId: parentId, 22 | balance: balance, 23 | currency: currency, 24 | }); 25 | account 26 | .save() 27 | .then((account) => { 28 | res.status(200).json({ success: true, account }); 29 | }) 30 | .catch((err) => { 31 | res.status(400).json({ success: false, err }); 32 | }); 33 | }); 34 | 35 | router.get("/get/:id", auth, (req, res) => { 36 | Account.findById(req.params.id) 37 | .then((account) => { 38 | res.status(200).json({ success: true, account }); 39 | }) 40 | .catch((err) => { 41 | res.status(400).json({ success: false, err }); 42 | }); 43 | }); 44 | 45 | router.delete("/delete/:id", auth, (req, res) => { 46 | Account.findByIdAndDelete(req.params.id) 47 | .then((account) => { 48 | res.status(200).json({ success: true, account }); 49 | }) 50 | .catch((err) => { 51 | res.status(400).json({ success: false, err }); 52 | }); 53 | }); 54 | 55 | router.put("/update/:id", auth, (req, res) => { 56 | const { name, balance, currency, parentId, familyId } = req.body; 57 | var token = req.header("Authorization"); 58 | const decoded = jwt.verify(token, process.env.JWT_SECRET); 59 | Account.findByIdAndUpdate(req.params.id, { 60 | name: name, 61 | userId: decoded.userId, 62 | familyId: familyId, 63 | updatedBy: decoded.email, 64 | updatedDate: new Date(), 65 | parentId: parentId, 66 | balance: balance, 67 | currency: currency, 68 | }) 69 | .then((account) => { 70 | res.status(200).json({ success: true, account }); 71 | }) 72 | .catch((err) => { 73 | res.status(400).json({ success: false, err }); 74 | }); 75 | }); 76 | 77 | router.get("/getByFamily/:id", auth, (req, res) => { 78 | Account.find({ familyId: req.params.id }) 79 | .then((accounts) => { 80 | res.status(200).json({ success: true, accounts }); 81 | }) 82 | .catch((err) => { 83 | res.status(400).json({ success: false, err }); 84 | }); 85 | }); 86 | 87 | router.get("/getByUser/:id", auth, (req, res) => { 88 | Account.find({ userId: req.params.id }) 89 | .then((accounts) => { 90 | res.status(200).json({ success: true, accounts }); 91 | }) 92 | .catch((err) => { 93 | res.status(400).json({ success: false, err }); 94 | }); 95 | }); 96 | 97 | module.exports = router; 98 | -------------------------------------------------------------------------------- /backend/controllers/category.js: -------------------------------------------------------------------------------- 1 | // create category crud using express 2 | 3 | const express = require("express"); 4 | const router = express.Router(); 5 | const Category = require("../models/category"); 6 | const auth = require("../middleware/auth"); 7 | const jwt = require("jsonwebtoken"); 8 | 9 | router.post("/add", auth, (req, res) => { 10 | const { name, parentId, familyId, description } = req.body; 11 | var token = req.header("Authorization"); 12 | const decoded = jwt.verify(token, process.env.TOKEN_KEY); 13 | const category = new Category({ 14 | name: name, 15 | description: description, 16 | userId: decoded.userId, 17 | createdBy: decoded.email, 18 | createdDate: new Date(), 19 | parentId: parentId, 20 | familyId: familyId 21 | }) 22 | category.save().then((category) => { 23 | res.status(200).json({ success: true, category }) 24 | }).catch((err) => { 25 | res.status(400).json({ success: false, err }) 26 | }) 27 | }) 28 | 29 | router.get('/get', (req, res) => { 30 | var token = req.header("Authorization"); 31 | const decoded = jwt.verify(token, process.env.TOKEN_KEY); 32 | let userId = decoded.userId; 33 | Category.findById({userId : id}).then((category) => { 34 | res.status(200).json({ success: true, category }) 35 | }).catch((err) => { 36 | res.status(400).json({ success: false, err }) 37 | }) 38 | }) 39 | 40 | router.delete('/delete/:id', (req, res) => { 41 | Category.findByIdAndDelete(req.params.id).then((category) => { 42 | res.status(200).json({ success: true, category }) 43 | }).catch((err) => { 44 | res.status(400).json({ success: false, err }) 45 | }) 46 | }) 47 | 48 | router.put('/update/:id',auth,(req,res)=>{ 49 | const {name, parentId, familyId, description} = req.body; 50 | var token = req.header("Authorization"); 51 | const decoded = jwt.verify(token, process.env.TOKEN_KEY); 52 | const date = new Date(); 53 | Category.findByIdAndUpdate(req.params.id,{ 54 | name: name, 55 | parentId: parentId, 56 | userId: decoded.userId, 57 | familyId: familyId, 58 | categoryId: categoryId, 59 | updatedBy: decoded.email, 60 | updatedDate: date 61 | }).then((transaction)=>{ 62 | res.status(200).json({success:true,transaction}) 63 | }).catch((err)=>{ 64 | res.status(400).json({success:false,err}) 65 | }) 66 | }) 67 | router.get('/getall',auth,(req,res)=>{ 68 | Category.find().then((category)=>{ 69 | res.status(200).json({success:true,category}) 70 | }).catch((err)=>{ 71 | res.status(400).json({success:false,err}) 72 | }) 73 | }) 74 | 75 | router.get('/getByFamilyId/:id',auth,(req,res)=>{ 76 | Category.find({familyId:req.params.id}).then((category)=>{ 77 | res.status(200).json({success:true,category}) 78 | }).catch((err)=>{ 79 | res.status(400).json({success:false,err}) 80 | }) 81 | }) 82 | 83 | router.get('/getByUserId/:id',auth,(req,res)=>{ 84 | Category.find({userId:req.params.id}).then((category)=>{ 85 | res.status(200).json({success:true,category}) 86 | }).catch((err)=>{ 87 | res.status(400).json({success:false,err}) 88 | }) 89 | }) 90 | 91 | module.exports = router; -------------------------------------------------------------------------------- /backend/controllers/chart.js: -------------------------------------------------------------------------------- 1 | // create chart crud using express 2 | 3 | const express = require('express'); 4 | const router = express.Router(); 5 | const Category = require('../models/category'); 6 | const Transaction = require('../models/transaction'); 7 | const auth = require('../middleware/auth'); 8 | 9 | router.get('/get/:id', auth, (req, res) => { 10 | let transactions = []; 11 | Transaction.find({ userId: req.params.id }).then((transaction) => { 12 | transactions = transaction; 13 | }).catch((err) => { 14 | res.status(400).json({ success: false, err }) 15 | }) 16 | let categories = []; 17 | Category.findById(req.params.id).then((Category) => { 18 | categories = Category; 19 | }).catch((err) => { 20 | res.status(400).json({ success: false, err }) 21 | }) 22 | let charts = []; 23 | categories.map((category) => { 24 | let categoryId = category._id; 25 | let categoryAmount = 0; 26 | let categortyName = category.name; 27 | transactions.map((transaction) => { 28 | if (category._id === transaction.categoryId) { 29 | categoryAmount = categoryAmount + transaction.amount; 30 | } 31 | }) 32 | charts.push({ 33 | categoryId, 34 | categoryAmount, 35 | categortyName 36 | }) 37 | }) 38 | res.status(200).json({ success: true, charts }) 39 | }) 40 | 41 | router.get('/getMonthwiseExpense/:id', auth, (req, res) => { 42 | let expenses = []; 43 | //filter transactions by month 44 | Transaction.find({ userId: req.params.id }).then((transaction) => { 45 | expenses = transaction; 46 | }).catch((err) => { 47 | res.status(400).json({ success: false, err }) 48 | }) 49 | 50 | 51 | let monthwiseExpense = []; 52 | expenses.map((expense) => { 53 | let month = expense.createdDate.getMonth(); 54 | let year = expense.createdDate.getFullYear(); 55 | let amount = expense.amount; 56 | let monthName = expense.createdDate.toLocaleString('default', { month: 'long' }); 57 | let monthYear = monthName + ' ' + year; 58 | let monthYearId = month + '' + year; 59 | let monthYearAmount = 0; 60 | // fliter if monthwiseExpense already exists 61 | let flag = true; 62 | monthwiseExpense.map((monthwiseExpense) => { 63 | if (monthYearId === monthwiseExpense.monthYearId) { 64 | flag = false; 65 | } 66 | }) 67 | if(flag){ 68 | expenses.map((expense) => { 69 | if (monthYearId === (expense.createdDate.getMonth() + '' + expense.createdDate.getFullYear())) { 70 | monthYearAmount = monthYearAmount + expense.amount; 71 | } 72 | }) 73 | monthwiseExpense.push({ 74 | monthYearId, 75 | monthYear, 76 | monthYearAmount 77 | }) 78 | } 79 | }) 80 | res.status(200).json({ success: true, monthwiseExpense }) 81 | }) 82 | 83 | module.exports = router; 84 | 85 | -------------------------------------------------------------------------------- /backend/controllers/family.js: -------------------------------------------------------------------------------- 1 | // create crud api using express 2 | const express = require('express'); 3 | const router = express.Router(); 4 | const FamilyModel = require('../models/family'); 5 | const auth = require('../middleware/auth'); 6 | 7 | router.post('/add', auth, (req, res) => { 8 | const { familyName, userId } = req.body; 9 | const family = new FamilyModel({ 10 | familyName, 11 | userId 12 | }) 13 | family.save().then((family) => { 14 | res.status(200).json({ success: true, family }) 15 | }).catch((err) => { 16 | res.status(400).json({ success: false, err }) 17 | }) 18 | }) 19 | 20 | router.get('/get/:id', (req, res) => { 21 | FamilyModel.findById(req.params.id).then((family) => { 22 | res.status(200).json({ success: true, family }) 23 | }).catch((err) => { 24 | res.status(400).json({ success: false, err }) 25 | }) 26 | }) 27 | 28 | router.put('/update/:id', auth, (req, res) => { 29 | const { familyName, userId } = req.body; 30 | FamilyModel.findByIdAndUpdate(req.params.id, { 31 | familyName, 32 | userId 33 | }).then((family) => { 34 | res.status(200).json({ success: true, family }) 35 | }).catch((err) => { 36 | res.status(400).json({ success: false, err }) 37 | }) 38 | }) 39 | 40 | router.delete('/delete/:id', auth, (req, res) => { 41 | FamilyModel.findByIdAndDelete(req.params.id).then((family) => { 42 | res.status(200).json({ success: true, family }) 43 | }).catch((err) => { 44 | res.status(400).json({ success: false, err }) 45 | }) 46 | }) 47 | 48 | router.get('/getUserById/:id', (req, res) => { 49 | FamilyModel.find({ userId: req.params.userId }).then((family) => { 50 | res.status(200).json({ success: true, family }) 51 | }).catch((err) => { 52 | res.status(400).json({ success: false, err }) 53 | }) 54 | }) 55 | 56 | module.exports = router; 57 | 58 | 59 | -------------------------------------------------------------------------------- /backend/controllers/transaction.js: -------------------------------------------------------------------------------- 1 | // create crud api for transaction using express 2 | const express = require("express"); 3 | const router = express.Router(); 4 | const Transaction = require("../models/transaction"); 5 | const User = require("../models/user"); 6 | const auth = require("../middleware/auth"); 7 | const jwt = require("jsonwebtoken"); 8 | 9 | router.post("/add", auth, (req, res) => { 10 | const { 11 | amount, 12 | description, 13 | categoryId, 14 | accountId, 15 | familyId, 16 | transactionType, 17 | } = req.body; 18 | var token = req.header("Authorization"); 19 | const decoded = jwt.verify(token, process.env.TOKEN_KEY); 20 | const transaction = new Transaction({ 21 | amount: amount, 22 | description: description, 23 | userId: decoded.userId, 24 | familyId: familyId, 25 | categoryId: categoryId, 26 | accountId: accountId, 27 | transactionType: transactionType, 28 | createdBy: decoded.email, 29 | createdDate: new Date(), 30 | }); 31 | transaction 32 | .save() 33 | .then((transaction) => { 34 | res.status(200).json({ success: true, transaction }); 35 | }) 36 | .catch((err) => { 37 | res.status(400).json({ success: false, err }); 38 | }); 39 | }); 40 | 41 | router.get("/get/:id", auth, (req, res) => { 42 | Transaction.findById(req.params.id) 43 | .then((transaction) => { 44 | res.status(200).json({ success: true, transaction }); 45 | }) 46 | .catch((err) => { 47 | res.status(400).json({ success: false, err }); 48 | }); 49 | }); 50 | 51 | router.put("/update/:id", auth, (req, res) => { 52 | const { 53 | amount, 54 | description, 55 | categoryId, 56 | accountId, 57 | familyId, 58 | transactionType, 59 | } = req.body; 60 | var token = req.header("Authorization"); 61 | const decoded = jwt.verify(token, process.env.TOKEN_KEY); 62 | Transaction.findByIdAndUpdate(req.params.id, { 63 | amount: amount, 64 | description: description, 65 | userId: decoded.userId, 66 | familyId: familyId, 67 | categoryId: categoryId, 68 | accountId: accountId, 69 | transactionType: transactionType, 70 | updatedBy: decoded.email, 71 | updatedDate: new Date(), 72 | }) 73 | .then((transaction) => { 74 | res.status(200).json({ success: true, transaction }); 75 | }) 76 | .catch((err) => { 77 | res.status(400).json({ success: false, err }); 78 | }); 79 | }); 80 | 81 | router.delete("/delete/:id", auth, (req, res) => { 82 | Transaction.findByIdAndDelete(req.params.id) 83 | .then((transaction) => { 84 | res.status(200).json({ success: true, transaction }); 85 | }) 86 | .catch((err) => { 87 | res.status(400).json({ success: false, err }); 88 | }); 89 | }); 90 | 91 | router.get("/getByUser/:id", auth, (req, res) => { 92 | Transaction.find({ userId: req.params.id }) 93 | .then((transactions) => { 94 | res.status(200).json({ success: true, transactions }); 95 | }) 96 | .catch((err) => { 97 | res.status(400).json({ success: false, err }); 98 | }); 99 | }); 100 | 101 | router.get("/getByFamily/:id", auth, (req, res) => { 102 | Transaction.find({ familyId: req.params.id }) 103 | .then((transactions) => { 104 | res.status(200).json({ success: true, transactions }); 105 | }) 106 | .catch((err) => { 107 | res.status(400).json({ success: false, err }); 108 | }); 109 | }); 110 | 111 | router.get("/getByCategory/:id", auth, (req, res) => { 112 | Transaction.find({ categoryId: req.params.id }) 113 | .then((transactions) => { 114 | res.status(200).json({ success: true, transactions }); 115 | }) 116 | .catch((err) => { 117 | res.status(400).json({ success: false, err }); 118 | }); 119 | }); 120 | 121 | router.get("/getByAccount/:id", auth, (req, res) => { 122 | Transaction.find({ accountId: req.params.id }) 123 | .then((transactions) => { 124 | res.status(200).json({ success: true, transactions }); 125 | }) 126 | .catch((err) => { 127 | res.status(400).json({ success: false, err }); 128 | }); 129 | }); 130 | 131 | router.get("/getByUserAndFamily/:userId/:familyId", auth, (req, res) => { 132 | Transaction.find({ userId: req.params.userId, familyId: req.params.familyId }) 133 | .then((transactions) => { 134 | res.status(200).json({ success: true, transactions }); 135 | }) 136 | .catch((err) => { 137 | res.status(400).json({ success: false, err }); 138 | }); 139 | }); 140 | 141 | router.get("/getByUserAndCategory/:userId/:categoryId", auth, (req, res) => { 142 | Transaction.find({ 143 | userId: req.params.userId, 144 | categoryId: req.params.categoryId, 145 | }) 146 | .then((transactions) => { 147 | res.status(200).json({ success: true, transactions }); 148 | }) 149 | .catch((err) => { 150 | res.status(400).json({ success: false, err }); 151 | }); 152 | }); 153 | 154 | router.get("/getByUserAndAccount/:userId/:accountId", auth, (req, res) => { 155 | Transaction.find({ 156 | userId: req.params.userId, 157 | accountId: req.params.accountId, 158 | }) 159 | .then((transactions) => { 160 | res.status(200).json({ success: true, transactions }); 161 | }) 162 | .catch((err) => { 163 | res.status(400).json({ success: false, err }); 164 | }); 165 | }); 166 | 167 | router.get( 168 | "/getByFamilyAndCategory/:familyId/:categoryId", 169 | auth, 170 | (req, res) => { 171 | Transaction.find({ 172 | familyId: req.params.familyId, 173 | categoryId: req.params.categoryId, 174 | }) 175 | .then((transactions) => { 176 | res.status(200).json({ success: true, transactions }); 177 | }) 178 | .catch((err) => { 179 | res.status(400).json({ success: false, err }); 180 | }); 181 | } 182 | ); 183 | 184 | module.exports = router; 185 | -------------------------------------------------------------------------------- /backend/controllers/user.js: -------------------------------------------------------------------------------- 1 | // create signup api Path: backend\controllers\user.js 2 | 3 | const express = require("express"); 4 | const router = express.Router(); 5 | const UserModel = require("../models/user"); 6 | const bcrypt = require("bcrypt"); 7 | const jwt = require("jsonwebtoken"); 8 | 9 | router.get("/getUsers", async (req, res) => { 10 | const users = await UserModel.find(); 11 | res.status(201).json(users); 12 | }); 13 | 14 | router.get("/getCurrentUser", async (req, res) => { 15 | if (req.headers && req.headers.authorization) { 16 | var authorization = req.headers.authorization, 17 | decoded; 18 | try { 19 | decoded = jwt.verify(authorization, process.env.TOKEN_KEY); 20 | } catch (e) { 21 | return res.status(401).send("unauthorized"); 22 | } 23 | var email = decoded.email; 24 | // Fetch the user by id 25 | const user = await UserModel.findOne({ email: email }); 26 | return res.status(200).json({ email: user.email, name: user.name }); 27 | } 28 | return res.send(500); 29 | }); 30 | 31 | router.post("/signup", async (req, res) => { 32 | try { 33 | const { name, email, password } = req.body; 34 | 35 | if (!(name && email && password)) { 36 | res.status(400).send("All inputs are required"); 37 | } 38 | 39 | const oldUser = await UserModel.findOne({ email }); 40 | 41 | if (oldUser) { 42 | return res.status(409).send("User Already Exist. Please Login"); 43 | } 44 | 45 | encryptedPassword = await bcrypt.hash(password, 10); 46 | 47 | const user = await UserModel.create({ 48 | email: email.toLowerCase(), 49 | password: encryptedPassword, 50 | name, 51 | }); 52 | 53 | const token = jwt.sign( 54 | { user_id: user._id, email, name }, 55 | process.env.TOKEN_KEY, 56 | { 57 | expiresIn: "2h", 58 | } 59 | ); 60 | res.status(201).json(token); 61 | } catch (err) { 62 | console.log(err); 63 | } 64 | }); 65 | 66 | router.post("/signin", async (req, res) => { 67 | try { 68 | const { email, password } = req.body; 69 | 70 | if (!(email && password)) { 71 | res.status(400).send("All input is required"); 72 | } 73 | const user = await UserModel.findOne({ email }); 74 | if (user && (await bcrypt.compare(password, user.password))) { 75 | const token = jwt.sign( 76 | { user_id: user._id, email }, 77 | process.env.TOKEN_KEY, 78 | { 79 | expiresIn: "2h", 80 | } 81 | ); 82 | 83 | res.status(200).json(token); 84 | } else { 85 | res.status(400).send("Invalid Credentials"); 86 | } 87 | } catch (err) { 88 | console.log(err); 89 | } 90 | }); 91 | 92 | module.exports = router; 93 | -------------------------------------------------------------------------------- /backend/database/database.js: -------------------------------------------------------------------------------- 1 | // create localhost connection using mongoose 2 | const mongoose = require('mongoose'); 3 | const env = require('dotenv').config(); 4 | 5 | mongoose.connect(process.env.MONGO_URI,{ 6 | useNewUrlParser:true, 7 | useUnifiedTopology: true, 8 | }).then(()=>{ 9 | console.log('connected to database') 10 | }).catch((err)=>{ 11 | console.log(err) 12 | }) 13 | 14 | module.exports = mongoose; 15 | -------------------------------------------------------------------------------- /backend/middleware/auth.js: -------------------------------------------------------------------------------- 1 | // create auth middleware 2 | const jwt = require("jsonwebtoken"); 3 | const User = require("../models/user"); 4 | 5 | const auth = (req, res, next) => { 6 | const token = req.header("Authorization"); 7 | console.log(token, "tokennnnnn"); 8 | if (!token) 9 | return res.status(401).json({ success: false, message: "Access denied" }); 10 | try { 11 | const decoded = jwt.verify(token, process.env.TOKEN_KEY); 12 | console.log(decoded, "dddddddddddd"); 13 | User.findById(decoded._id) 14 | .then((user) => { 15 | req.user = user; 16 | next(); 17 | }) 18 | .catch((err) => { 19 | res.status(400).json({ success: false, err }); 20 | }); 21 | } catch (err) { 22 | res.status(400).json({ success: false, err }); 23 | } 24 | }; 25 | 26 | module.exports = auth; 27 | -------------------------------------------------------------------------------- /backend/models/account.js: -------------------------------------------------------------------------------- 1 | // create user schema in backend\modals\account.js: where schema contains id, name, balance, currency, parentId, familyId, userId, createdby, updatedby, createddate, updateddate 2 | const mongoose = require('mongoose'); 3 | const Schema = mongoose.Schema, 4 | ObjectId = Schema.ObjectId; 5 | const accountSchema = new Schema({ 6 | name:{ 7 | type:String, 8 | trim:true 9 | }, 10 | balance:{ 11 | type:Number, 12 | trim:true 13 | }, 14 | currency:{ 15 | type:String, 16 | required:true, 17 | trim:true 18 | }, 19 | parentId:{ 20 | type: String, 21 | trim:true 22 | }, 23 | familyId:{ 24 | type:String, 25 | trim:true 26 | }, 27 | userId:{ 28 | type:ObjectId, 29 | trim:true 30 | }, 31 | createdBy:{ 32 | type:String, 33 | trim:true 34 | }, 35 | updatedBy:{ 36 | type:String, 37 | trim:true 38 | }, 39 | createdDate:{ 40 | type:Date, 41 | trim:true 42 | }, 43 | updatedDate:{ 44 | type:Date, 45 | trim:true 46 | }, 47 | }) 48 | module.exports = mongoose.model('Account',accountSchema); -------------------------------------------------------------------------------- /backend/models/category.js: -------------------------------------------------------------------------------- 1 | // create mongo user schema in backend\modals\category.js: where schema id, name, parentId, familyId, userId, createdBy, updatedBy, createdDate, updatedDate 2 | 3 | const mongoose = require('mongoose'); 4 | const Schema = mongoose.Schema; 5 | const categorySchema = new Schema({ 6 | name:{ 7 | type:String, 8 | trim:true 9 | }, 10 | parentId:{ 11 | type:String, 12 | trim:true 13 | }, 14 | familyId:{ 15 | type:String, 16 | trim:true 17 | }, 18 | userId:{ 19 | type:String, 20 | trim:true 21 | }, 22 | createdBy:{ 23 | type:String, 24 | trim:true 25 | }, 26 | updatedBy:{ 27 | type:String, 28 | trim:true 29 | }, 30 | createdDate:{ 31 | type:Date, 32 | trim:true 33 | }, 34 | updatedDate:{ 35 | type:Date, 36 | trim:true 37 | }, 38 | }) 39 | 40 | module.exports = mongoose.model('Category',categorySchema); 41 | -------------------------------------------------------------------------------- /backend/models/family.js: -------------------------------------------------------------------------------- 1 | // create mongo user schema in backend\modals\category.js: where schema id, userId, familyName 2 | 3 | const mongoose = require("mongoose"); 4 | const Schema = mongoose.Schema, 5 | ObjectId = Schema.ObjectId; 6 | const familySchema = new Schema({ 7 | userId: { 8 | type: ObjectId, 9 | }, 10 | familyName: { 11 | type: String, 12 | }, 13 | }); 14 | module.exports = mongoose.model("Family", familySchema); 15 | 16 | // Path: family.js 17 | -------------------------------------------------------------------------------- /backend/models/transaction.js: -------------------------------------------------------------------------------- 1 | // create mongo user schema in backend\modals\transaction.js: where schema id, description, amount, categoryId, accountId, familyId, userId, createdBy, updatedBy, createdDate, updatedDate, credit, debit 2 | 3 | const mongoose = require("mongoose"); 4 | const Schema = mongoose.Schema, 5 | ObjectId = Schema.ObjectId; 6 | const transactionSchema = new Schema({ 7 | description: { 8 | type: String, 9 | trim: true, 10 | }, 11 | amount: { 12 | type: Number, 13 | trim: true, 14 | }, 15 | categoryId: { 16 | type: ObjectId, 17 | trim: true, 18 | }, 19 | accountId: { 20 | type: ObjectId, 21 | trim: true, 22 | }, 23 | familyId: { 24 | type: String, 25 | trim: true, 26 | }, 27 | userId: { 28 | type: ObjectId, 29 | trim: true, 30 | }, 31 | transactionType: { 32 | type: Boolean, 33 | }, 34 | createdBy: { 35 | type: String, 36 | trim: true, 37 | }, 38 | updatedBy: { 39 | type: String, 40 | trim: true, 41 | }, 42 | createdDate: { 43 | type: Date, 44 | trim: true, 45 | }, 46 | updatedDate: { 47 | type: Date, 48 | trim: true, 49 | }, 50 | }); 51 | 52 | module.exports = mongoose.model("Transaction", transactionSchema); 53 | -------------------------------------------------------------------------------- /backend/models/user.js: -------------------------------------------------------------------------------- 1 | // create user schema in backend\modals\user.js: 2 | const mongoose = require('mongoose'); 3 | const Schema = mongoose.Schema; 4 | const userSchema = new Schema({ 5 | name:{ 6 | type:String, 7 | required:true, 8 | trim:true, 9 | min:3, 10 | max:20 11 | }, 12 | email:{ 13 | type:String, 14 | required:true, 15 | }, 16 | password: { 17 | type: String, 18 | required: true, 19 | min: 6, 20 | max: 20, 21 | }, 22 | }) 23 | 24 | module.exports = mongoose.model('User',userSchema); -------------------------------------------------------------------------------- /backend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-auth", 3 | "version": "1.0.0", 4 | "scripts": { 5 | "start": "node server.js", 6 | "dev": "nodemon server.js", 7 | "debug": "node --nolazy server.js" 8 | }, 9 | "dependencies": { 10 | "bcrypt": "^5.1.0", 11 | "body-parser": "^1.20.2", 12 | "cors": "^2.8.5", 13 | "dotenv": "^16.3.1", 14 | "express": "^4.18.2", 15 | "jsonwebtoken": "^9.0.0", 16 | "moment": "^2.29.4", 17 | "mongoose": "^7.3.1" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /backend/server.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | var bodyParser = require('body-parser') 3 | var env = require('dotenv').config(); 4 | var path = require('path') 5 | var cors = require('cors'); 6 | const db = require('./database/database') 7 | const app = express(); 8 | const user = require('./controllers/user') 9 | const transaction = require('./controllers/transaction') 10 | const family = require('./controllers/family') 11 | const chart = require('./controllers/chart') 12 | const account = require('./controllers/account') 13 | const category = require('./controllers/category') 14 | 15 | const PORT = process.env.PORT || 4000; 16 | 17 | app.use(bodyParser.urlencoded({ extended: false })) 18 | // parse application/json 19 | app.use(bodyParser.json()) 20 | app.use(express.static('public')); 21 | app.use('/images', express.static('images')); 22 | var corsOptions = { 23 | origin: '*', 24 | optionsSuccessStatus: 200 25 | } 26 | 27 | app.use(cors(corsOptions)); 28 | 29 | app.use('/user',user); 30 | app.use('/transaction',transaction); 31 | app.use('/account',account); 32 | app.use('/category',category); 33 | app.use('/family',family); 34 | app.use('/chart',chart); 35 | app.get('',(req,res)=>{ 36 | res.send('working fine') 37 | }) 38 | 39 | app.listen(PORT,()=>{ 40 | console.log('running on port '+PORT); 41 | }) -------------------------------------------------------------------------------- /frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | 25 | .env -------------------------------------------------------------------------------- /frontend/README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. 13 | 14 | The page will reload when you make changes.\ 15 | You may also see any lint errors in the console. 16 | 17 | ### `npm test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `npm run build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `npm run eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!** 35 | 36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. 39 | 40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | 48 | ### Code Splitting 49 | 50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) 51 | 52 | ### Analyzing the Bundle Size 53 | 54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) 55 | 56 | ### Making a Progressive Web App 57 | 58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) 59 | 60 | ### Advanced Configuration 61 | 62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) 63 | 64 | ### Deployment 65 | 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 67 | 68 | ### `npm run build` fails to minify 69 | 70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) 71 | -------------------------------------------------------------------------------- /frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "frontend", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@ant-design/icons": "^5.1.4", 7 | "@tanstack/react-query": "^4.29.15", 8 | "@testing-library/jest-dom": "^5.16.5", 9 | "@testing-library/react": "^14.0.0", 10 | "@testing-library/user-event": "^14.4.3", 11 | "antd": "^5.6.2", 12 | "axios": "^1.4.0", 13 | "bootstrap": "^5.3.0", 14 | "chart.js": "^4.3.0", 15 | "node-sass": "^9.0.0", 16 | "react": "^18.2.0", 17 | "react-bootstrap": "^2.8.0", 18 | "react-chartjs-2": "^5.2.0", 19 | "react-dom": "^18.2.0", 20 | "react-gravatar": "^2.6.3", 21 | "react-router-dom": "^6.14.0", 22 | "react-scripts": "5.0.1", 23 | "sweetalert2": "^11.7.12", 24 | "web-vitals": "^3.3.2" 25 | }, 26 | "scripts": { 27 | "start": "react-scripts start", 28 | "build": "react-scripts build", 29 | "test": "react-scripts test", 30 | "eject": "react-scripts eject" 31 | }, 32 | "eslintConfig": { 33 | "extends": [ 34 | "react-app", 35 | "react-app/jest" 36 | ] 37 | }, 38 | "browserslist": { 39 | "production": [ 40 | ">0.2%", 41 | "not dead", 42 | "not op_mini all" 43 | ], 44 | "development": [ 45 | "last 1 chrome version", 46 | "last 1 firefox version", 47 | "last 1 safari version" 48 | ] 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/frontend/public/favicon.ico -------------------------------------------------------------------------------- /frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | Veersatech Finance Tracker 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /frontend/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/frontend/public/logo192.png -------------------------------------------------------------------------------- /frontend/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/frontend/public/logo512.png -------------------------------------------------------------------------------- /frontend/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /frontend/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /frontend/src/App.js: -------------------------------------------------------------------------------- 1 | import { Route, Routes, useNavigate } from "react-router-dom"; 2 | import { 3 | DashboardPage, 4 | FinancesPage, 5 | HomePage, 6 | NotFoundPage, 7 | CategoryPage, 8 | } from "./pages"; 9 | import { useEffect } from "react"; 10 | import Swal from "sweetalert2"; 11 | import { loadUser, setAuthToken } from "./apis"; 12 | 13 | import { useAuth } from "./contexts/AuthContext"; 14 | import PrivateRoutes from "./routes/PrivateRoutes"; 15 | import AccountsPage from "./pages/AccountsPage"; 16 | 17 | function App() { 18 | const navigate = useNavigate(); 19 | const { setCurrentUser, loggedIn, setLoggedIn } = useAuth(); 20 | const authToken = localStorage.getItem("token"); 21 | 22 | useEffect(() => { 23 | if (authToken) { 24 | setAuthToken(authToken); 25 | 26 | const getUser = async () => { 27 | try { 28 | const user = await loadUser(); 29 | console.log("user: ", user); 30 | setCurrentUser(user); 31 | setLoggedIn(true); 32 | } catch (error) { 33 | console.log("error: ", error); 34 | Swal.fire({ 35 | icon: "error", 36 | title: "Oops...", 37 | text: "Something went wrong!", 38 | }); 39 | localStorage.removeItem("authToken"); 40 | setLoggedIn(false); 41 | navigate("/"); 42 | } 43 | }; 44 | getUser(); 45 | } 46 | }, [authToken]); 47 | 48 | return ( 49 | 50 | } /> 51 | 54 | } 55 | > 56 | } /> 57 | } /> 58 | } /> 59 | } /> 60 | 61 | 62 | } /> 63 | 64 | ); 65 | } 66 | 67 | export default App; 68 | -------------------------------------------------------------------------------- /frontend/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /frontend/src/Components/Chart.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from "react"; 2 | import { 3 | Chart as ChartJS, 4 | CategoryScale, 5 | LinearScale, 6 | BarElement, 7 | Title, 8 | Tooltip, 9 | Legend, 10 | } from "chart.js"; 11 | import { Bar } from "react-chartjs-2"; 12 | import { DEFAULT_FILTER_LABEL, overallData } from "../utils/chart-mock-data"; 13 | 14 | ChartJS.register( 15 | CategoryScale, 16 | LinearScale, 17 | BarElement, 18 | Title, 19 | Tooltip, 20 | Legend 21 | ); 22 | 23 | export default function BarChart() { 24 | const [labels, setLabels] = useState([]); 25 | const [chartData, setChartData] = useState([]); 26 | const data = { 27 | labels, 28 | datasets: [ 29 | { 30 | label: DEFAULT_FILTER_LABEL.label, 31 | data: chartData, 32 | backgroundColor: "rgba(255, 99, 132, 0.5)", 33 | }, 34 | ], 35 | }; 36 | useEffect(() => { 37 | if (labels.length === 0 && chartData.length === 0) { 38 | overallData.map((ele, idx) => { 39 | labels.push(ele.month); 40 | chartData.push(ele.expense); 41 | }); 42 | } 43 | }, []); 44 | return ( 45 | <> 46 | 47 | 48 | ); 49 | } 50 | 51 | export const options = { 52 | responsive: true, 53 | plugins: { 54 | legend: { 55 | position: "top", 56 | }, 57 | title: { 58 | display: true, 59 | text: "Budget Trends", 60 | }, 61 | }, 62 | }; 63 | -------------------------------------------------------------------------------- /frontend/src/Components/Common/NavbarComponent.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { 3 | Button, 4 | Container, 5 | Form, 6 | Nav, 7 | NavDropdown, 8 | Navbar, 9 | } from "react-bootstrap"; 10 | import { useAuth } from "../../contexts/AuthContext"; 11 | import CreateForm from "../Form/CreateForm"; 12 | import { FormBuilder } from "../../utils/constants"; 13 | import { useParams } from "react-router-dom"; 14 | 15 | const NavbarComponent = () => { 16 | const params = useParams(); 17 | console.log("params", params, window.location.pathname); 18 | const { currentUser, loggedIn, setLoggedIn } = useAuth(); 19 | console.log(FormBuilder["AddTransaction"]); 20 | 21 | const logout = () => { 22 | localStorage.clear(); 23 | setLoggedIn(false); 24 | }; 25 | return ( 26 | 27 | 28 | {/* */} 29 | Finance Tracker 30 | 31 | 32 | 72 | 73 | {/* username and icon */} 74 | 78 | 79 | 80 | 81 | ); 82 | }; 83 | 84 | export default NavbarComponent; 85 | -------------------------------------------------------------------------------- /frontend/src/Components/Finances/FinancesTable.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { Modal, Button, Form, Container, Table } from "react-bootstrap"; 3 | 4 | const FinancesTable = (props) => { 5 | const { 6 | amount, 7 | setAmount, 8 | transactionType, 9 | setTransactionType, 10 | description, 11 | setDescription, 12 | category, 13 | setCategory, 14 | date, 15 | setDate, 16 | show, 17 | setShow, 18 | handleClose, 19 | } = props; 20 | 21 | // const [show, setShow] = useState(false); 22 | 23 | // const handleClose = () => setShow(false); 24 | 25 | const renderTableRows = () => { 26 | console.log("data", props.data); 27 | return props.data.map((item) => ( 28 | 29 | {item.type} 30 | {item.name} 31 | {item.category} 32 | {item.date} 33 | {item.amount} 34 | 35 | )); 36 | }; 37 | 38 | return ( 39 |
40 | 41 | 42 | Create Transaction 43 | 44 | 45 |
46 | 47 | Amount 48 | setAmount(e.target.value)} 53 | /> 54 | 55 | 56 | Transaction Type 57 | setTransactionType(e.target.value)} 61 | > 62 | 63 | 64 | 65 | 66 | 67 | Category 68 | setCategory(e.target.value)} 73 | /> 74 | 75 | 76 | Description 77 | setDescription(e.target.value)} 82 | /> 83 | 84 | 85 | Date 86 | setDate(e.target.value)} 90 | /> 91 | 92 |
93 |
94 | 95 | 98 | 101 | 102 |
103 | 104 |
105 |

{props.name}

106 | 107 | 110 |
111 | 112 |
113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | {renderTableRows()} 125 |
TypeNameCategoryDateAmount
126 |
127 |
128 | ); 129 | }; 130 | 131 | export default FinancesTable; 132 | -------------------------------------------------------------------------------- /frontend/src/Components/Finances/SearchFilters.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Button, Col, Container, Form, Row } from "react-bootstrap"; 3 | 4 | const SearchFilters = () => { 5 | return ( 6 |
7 | {/* give code for search bar and filter button */} 8 | 9 | 12 |
13 | ); 14 | }; 15 | 16 | export default SearchFilters; 17 | -------------------------------------------------------------------------------- /frontend/src/Components/Finances/TableComponent.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Button, Container, Table } from "react-bootstrap"; 3 | import { useState } from 'react'; 4 | import Modal from 'react-bootstrap/Modal'; 5 | import Form from 'react-bootstrap/Form'; 6 | import {addCategory} from "../../apis/category.js"; 7 | 8 | const TableComponent = (props) => { 9 | const [show, setShow] = useState(false); 10 | const [data, setData] = useState([ 11 | { 12 | name: "Electric Bill", 13 | description: "Electric Bill desc", 14 | }, 15 | { 16 | name: "Groceries", 17 | description: "Groceries desc", 18 | }, 19 | ]); 20 | 21 | const handleClose = () => setShow(false); 22 | const handleShow = () => setShow(true); 23 | const [name, setName] = useState(''); 24 | const [description, setDescription] = useState(''); 25 | 26 | 27 | const renderTableRows = () => { 28 | return data.map((item) => ( 29 | 30 | {item.name} 31 | {item.description} 32 | 33 | )); 34 | }; 35 | 36 | const submitCategory = () => { 37 | console.log(name,description,'rrrrrrrrrrrrrrrr') 38 | const data = {name,parentId:"99",familyId:"99",description}; 39 | setData((c)=>{ 40 | return [...c,data] 41 | }) 42 | addCategory(data).then(res=>{ 43 | console.log(res,'rrrrrrrrrrrr'); 44 | setName(''); 45 | setDescription(''); 46 | }) 47 | handleClose() 48 | } 49 | 50 | return ( 51 |
52 |
53 |

{props.name}

54 | 57 |
58 | 59 |
60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | {renderTableRows()} 69 |
NameDescription
70 |
71 | 72 | 73 | 74 |
75 | 76 | Name 77 | setName(e.target.value)} type="text" /> 78 | 79 | 80 | Description 81 | setDescription(e.target.value)} as="textarea" rows={3} /> 82 | 83 |
84 |
85 | 86 | 87 | 88 |
89 |
90 | ); 91 | }; 92 | 93 | export default TableComponent; 94 | -------------------------------------------------------------------------------- /frontend/src/Components/Finances/index.js: -------------------------------------------------------------------------------- 1 | export { default as SearchFilters } from "./SearchFilters"; 2 | export { default as TableComponent } from "./TableComponent"; 3 | export { default as FinanceTable } from "./FinancesTable"; 4 | -------------------------------------------------------------------------------- /frontend/src/Components/Form/CreateForm.css: -------------------------------------------------------------------------------- 1 | .ant-col{ 2 | min-width: 30%; 3 | display: flex !important; 4 | } -------------------------------------------------------------------------------- /frontend/src/Components/Form/CreateForm.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { Button, Modal, Form, Input, Select, Radio, message } from "antd"; 3 | import { PlusOutlined } from "@ant-design/icons"; 4 | import { createTransaction } from "../../apis/transactions"; 5 | import "./CreateForm.css"; 6 | 7 | const { Option } = Select; 8 | 9 | const CreateForm = ({ recordType, recordFields, reload, handleSubmit }) => { 10 | // create a state variable to control the visibility of the popup 11 | const [visible, setVisible] = useState(false); 12 | 13 | // create a state variable to control the loading status of the popup 14 | const [confirmLoading, setConfirmLoading] = useState(false); 15 | 16 | // create a state variable to store the input values 17 | const [inputValues, setInputValues] = useState({}); 18 | 19 | // handle the submit button click event 20 | // const handleSubmit = async () => { 21 | // // set the loading status to true 22 | // setConfirmLoading(true); 23 | 24 | // // create a new record in the database 25 | // const response = await createTransaction(recordType, inputValues); 26 | 27 | // // if the response is successful 28 | // if (response.status === 200) { 29 | // // show a success message 30 | // message.success("Create Successfully"); 31 | 32 | // // reload the page 33 | // // reload(); 34 | // } else { 35 | // // show an error message 36 | // message.error(response.data); 37 | // } 38 | 39 | // // set the loading status to false 40 | // setConfirmLoading(false); 41 | 42 | // // close the popup 43 | // setVisible(false); 44 | // }; 45 | 46 | // handle the cancel button click event 47 | const handleCancel = () => { 48 | // close the popup 49 | setVisible(false); 50 | }; 51 | 52 | // handle the input value change event 53 | const handleChange = (event, field) => { 54 | // get the input value 55 | const inputValue = event.target.value; 56 | 57 | // update the input values 58 | setInputValues({ ...inputValues, [field]: inputValue }); 59 | }; 60 | return ( 61 |
62 | {/* open or not */} 63 | {!visible ? null : ( 64 | handleSubmit()} 68 | confirm 69 | onCancel={() => handleCancel()} 70 | confirmLoading={confirmLoading} 71 | okText="Create" 72 | > 73 |
74 | {recordFields?.map((field) => { 75 | return ( 76 | 77 | {field?.type === "input" ? ( 78 | handleChange(event, field?.name)} 81 | /> 82 | ) : field?.type === "select" ? ( 83 | 91 | ) : field?.type === "radio" ? ( 92 | handleChange(event, field?.name)} 94 | > 95 | {field?.options?.map((option) => { 96 | return {option}; 97 | })} 98 | 99 | ) : field?.type === "text" ? ( 100 | handleChange(event, field?.name)} 103 | type="text" 104 | /> 105 | ) : field?.type === "number" ? ( 106 | handleChange(event, field?.name)} 109 | type="number" 110 | /> 111 | ) : field?.type === "date" ? ( 112 | handleChange(event, field?.name)} 115 | type="date" 116 | /> 117 | ) : null} 118 | 119 | ); 120 | })} 121 |
122 |
123 | )} 124 | 131 |
132 | ); 133 | }; 134 | 135 | export default CreateForm; 136 | -------------------------------------------------------------------------------- /frontend/src/Components/Home/Features.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Col, Container } from "react-bootstrap"; 3 | 4 | const Features = () => { 5 | return ( 6 | 7 | 8 |

Track Expenses

9 |

10 | Easily track your expenses and categorize them to get a clear overview 11 | of your spending habits. 12 |

13 | 14 | 15 |

Manage Budget

16 |

17 | Set up a budget and monitor your progress to ensure you're staying 18 | within your financial goals. 19 |

20 | 21 | 22 | 23 |

Analyze Data

24 |

25 | Analyze your financial data with visual charts and graphs to gain 26 | insights into your spending patterns and identify areas for 27 | improvement. 28 |

29 | 30 | 31 |

Set Goals

32 |

33 | Define your financial goals and track your progress as you work 34 | towards achieving them. 35 |

36 | 37 |
38 | ); 39 | }; 40 | 41 | export default Features; 42 | -------------------------------------------------------------------------------- /frontend/src/Components/Home/Footer.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const Footer = () => { 4 | return ( 5 |
6 |

© 2023 Personal Finance Tracker. All rights reserved.

7 |
8 | ); 9 | }; 10 | 11 | export default Footer; 12 | -------------------------------------------------------------------------------- /frontend/src/Components/Home/HeroSection.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Button } from "react-bootstrap"; 3 | 4 | const HeroSection = ({ handleShow }) => { 5 | return ( 6 |
7 |

Welcome to Personal Finance Tracker

8 |

9 | Track your expenses, manage your budget, and stay on top of your 10 | financial goals. 11 |

12 | 15 |
16 | ); 17 | }; 18 | 19 | export default HeroSection; 20 | -------------------------------------------------------------------------------- /frontend/src/Components/Home/LoginModal.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { Button, Form, Modal } from "react-bootstrap"; 3 | import { useNavigate } from "react-router-dom"; 4 | import { useMutation } from "@tanstack/react-query"; 5 | import { loginUser, signUpUser } from "../../apis"; 6 | import CreateForm from "../Form/CreateForm"; 7 | 8 | const LoginModal = ({ show, handleClose, handleShow }) => { 9 | const navigate = useNavigate(); 10 | 11 | const loginMutation = useMutation(["login"], loginUser); 12 | const signupMutation = useMutation(["signup"], signUpUser); 13 | 14 | const [username, setUsername] = useState(""); 15 | const [email, setEmail] = useState(""); 16 | const [password, setPassword] = useState(""); 17 | const [isLoginForm, setIsLoginForm] = useState(true); 18 | 19 | function isValidEmail(email) { 20 | return /\S+@\S+\.\S+/.test(email); 21 | } 22 | 23 | // handle signup function to query localhost:4000/user/signup with email and password using axios 24 | const handleSignup = async () => { 25 | // use signUpUser function from apis.js 26 | try { 27 | const res = await signupMutation.mutateAsync({ 28 | username, 29 | email, 30 | password, 31 | }); 32 | console.log(res); 33 | 34 | if (res?.status === 201) { 35 | console.log("signup successful"); 36 | localStorage.setItem("token", res.data); 37 | handleClose(); 38 | // redirect to /dashboard 39 | navigate("/dashboard"); 40 | } 41 | } catch (error) { 42 | console.log(error); 43 | } 44 | }; 45 | 46 | const handleLogin = async () => { 47 | // use loginUser function from apis.js 48 | try { 49 | const res = await loginMutation.mutateAsync({ email, password }); 50 | console.log(res); 51 | 52 | if (res?.status === 200) { 53 | console.log("login successful"); 54 | localStorage.setItem("token", res.data); 55 | handleClose(); 56 | // redirect to /dashboard 57 | navigate("/dashboard"); 58 | } 59 | } catch (error) { 60 | console.log(error); 61 | } 62 | }; 63 | 64 | return ( 65 | 72 | 73 | Login/Register 74 | 75 | 76 |
77 | {!isLoginForm && ( 78 | 79 | Name 80 | setUsername(e.target.value)} 86 | autoFocus 87 | /> 88 | 89 | )} 90 | 91 | Email address 92 | setEmail(e.target.value)} 98 | isValid={isValidEmail(email)} 99 | isInvalid={email.length > 0 && !isValidEmail(email)} 100 | /> 101 | 102 | 103 | Password 104 | setPassword(e.target.value)} 110 | // isValid={password.length > 6} 111 | /> 112 | 113 |
114 |
115 | 122 | {/* */} 125 | {isLoginForm ? ( 126 | <> 127 | 134 |

135 | Don't have an account?   136 | setIsLoginForm(false)} 140 | > 141 | Sign up 142 | 143 |

144 | 145 | ) : ( 146 | <> 147 | 154 |

155 | Already have an account?   156 | setIsLoginForm(true)} 160 | > 161 | Login 162 | 163 |

164 | 165 | )} 166 |
167 |
168 | ); 169 | }; 170 | 171 | export default LoginModal; 172 | -------------------------------------------------------------------------------- /frontend/src/Components/Home/index.js: -------------------------------------------------------------------------------- 1 | export { default as HeroSection } from "./HeroSection"; 2 | export { default as Features } from "./Features"; 3 | export { default as Footer } from "./Footer"; 4 | export { default as LoginModal } from "./LoginModal"; 5 | -------------------------------------------------------------------------------- /frontend/src/Components/PieChart.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useRef, useState } from 'react'; 2 | import { Chart, registerables } from 'chart.js/auto'; 3 | import { overallData } from '../utils/pie-mock-data'; 4 | 5 | const PieChart = () => { 6 | const chartRef = useRef(null); 7 | const [category, setCategory] = useState([]); 8 | const [categoryData, setCategoryData] = useState([]); 9 | const [color, setColor] = useState([]); 10 | 11 | useEffect(() => { 12 | const ctx = chartRef.current.getContext('2d'); 13 | Chart.register(...registerables); 14 | 15 | if(category.length===0 && categoryData.length===0 && color.length===0) 16 | { 17 | overallData.map((ele, idx) => { 18 | category.push(ele.category); 19 | categoryData.push(ele.categoryData); 20 | color.push(ele.color); 21 | }) 22 | } 23 | const data = { 24 | labels: category, 25 | datasets: [{ 26 | data: categoryData, 27 | backgroundColor: color 28 | }] 29 | }; 30 | 31 | if (chartRef.current && chartRef.current.chart) { 32 | chartRef.current.chart.destroy(); 33 | } 34 | 35 | chartRef.current.chart = new Chart(ctx, { 36 | type: 'pie', 37 | data: data 38 | }); 39 | 40 | }, []); 41 | 42 | return ; 43 | }; 44 | 45 | export default PieChart; 46 | -------------------------------------------------------------------------------- /frontend/src/apis/category.js: -------------------------------------------------------------------------------- 1 | // create an CRUD transaction api call with base url from env and route /api/transaction using package Swal 2 | 3 | import Swal from "sweetalert2"; 4 | import { baseURL } from "."; 5 | import axios from "axios"; 6 | 7 | // create a function to get all transactions 8 | export const getCategory = async () => { 9 | try { 10 | const response = await axios.get(`${baseURL}/category/get`); 11 | return response; 12 | } catch (err) { 13 | console.log("getCategory err", err); 14 | } 15 | }; 16 | 17 | export const addCategory = async (payload) => { 18 | try { 19 | console.log("addCategory payload", payload); 20 | const response = await axios.post(`${baseURL}/category/add`,payload); 21 | return response; 22 | } catch (err) { 23 | Swal.fire({ 24 | icon: "error", 25 | text: err.response.data || "Add category failed!", 26 | toast: true, 27 | position: "top", 28 | showConfirmButton: false, 29 | timer: 3000, 30 | timerProgressBar: true, 31 | didOpen: (toast) => { 32 | toast.addEventListener("mouseenter", Swal.stopTimer); 33 | toast.addEventListener("mouseleave", Swal.resumeTimer); 34 | }, 35 | }); 36 | throw Error(err.response.data || "Add category failed!"); 37 | } 38 | }; -------------------------------------------------------------------------------- /frontend/src/apis/index.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | 3 | export const setAuthToken = (token) => { 4 | if (token) { 5 | axios.defaults.headers.common["Authorization"] = token; 6 | } else { 7 | delete axios.defaults.headers.common["Authorization"]; 8 | } 9 | }; 10 | 11 | export const baseURL = 12 | process.env.REACT_APP_BASE_URL || "http://localhost:4000"; 13 | 14 | export * from "./users"; 15 | -------------------------------------------------------------------------------- /frontend/src/apis/transactions.js: -------------------------------------------------------------------------------- 1 | // create an CRUD transaction api call with base url from env and route /api/transaction using package Swal 2 | 3 | import Swal from "sweetalert2"; 4 | import { baseURL } from "."; 5 | import axios from "axios"; 6 | 7 | // create a function to get all transactions 8 | export const getTransactions = async () => { 9 | try { 10 | const response = await axios.get(`${baseURL}/transaction`); 11 | return response; 12 | } catch (err) { 13 | console.log("getTransactions err", err); 14 | Swal.fire({ 15 | icon: "error", 16 | text: err.response.data || "Get all transactions failed!", 17 | toast: true, 18 | position: "top", 19 | showConfirmButton: false, 20 | timer: 3000, 21 | timerProgressBar: true, 22 | didOpen: (toast) => { 23 | toast.addEventListener("mouseenter", Swal.stopTimer); 24 | toast.addEventListener("mouseleave", Swal.resumeTimer); 25 | }, 26 | }); 27 | throw Error(err.response.data || "Get all transactions failed!"); 28 | } 29 | }; 30 | 31 | // create a function to get all transactions by id 32 | export const getTransactionById = async (id) => { 33 | try { 34 | const response = await axios.get(`${baseURL}/transaction/${id}`); 35 | return response; 36 | } catch (err) { 37 | console.log("getTransactionById err", err); 38 | Swal.fire({ 39 | icon: "error", 40 | text: err.response.data || "Get transaction by id failed!", 41 | toast: true, 42 | position: "top", 43 | showConfirmButton: false, 44 | timer: 3000, 45 | timerProgressBar: true, 46 | didOpen: (toast) => { 47 | toast.addEventListener("mouseenter", Swal.stopTimer); 48 | toast.addEventListener("mouseleave", Swal.resumeTimer); 49 | }, 50 | }); 51 | throw Error(err.response.data || "Get transaction by id failed!"); 52 | } 53 | }; 54 | 55 | // create a function to create a transaction 56 | export const createTransaction = async ({ amount, description }) => { 57 | try { 58 | const response = await axios.post(`${baseURL}/transaction/add`); 59 | Swal.fire({ 60 | icon: "success", 61 | text: "Transaction created successfully!", 62 | toast: true, 63 | position: "top", 64 | showConfirmButton: false, 65 | timer: 3000, 66 | timerProgressBar: true, 67 | didOpen: ( 68 | toast // create a function to update a transaction 69 | ) => { 70 | toast.addEventListener("mouseenter", Swal.stopTimer); 71 | toast.addEventListener("mouseleave", Swal.resumeTimer); 72 | }, 73 | }); 74 | return response; 75 | } catch (err) { 76 | console.log("createTransaction err", err); 77 | Swal.fire({ 78 | icon: "error", 79 | text: err.response.data || "Create transaction failed!", 80 | toast: true, 81 | position: "top", 82 | showConfirmButton: false, 83 | timer: 3000, 84 | timerProgressBar: true, 85 | didOpen: ( 86 | toast // create a function to update a transaction 87 | ) => { 88 | toast.addEventListener("mouseenter", Swal.stopTimer); 89 | toast.addEventListener("mouseleave", Swal.resumeTimer); 90 | }, 91 | }); 92 | throw Error(err.response.data || "Create transaction failed!"); 93 | } 94 | }; 95 | // create a function to delete a transaction 96 | export const removeTransactionById = async (_id) => { 97 | try { 98 | const response = await axios.delete(`${baseURL}/transaction/${_id}`); 99 | Swal.fire({ 100 | icon: "success", 101 | text: "Transaction deleted successfully!", 102 | toast: true, 103 | position: "top", 104 | showConfirmButton: false, 105 | timer: 3000, 106 | timerProgressBar: true, 107 | didOpen: ( 108 | toast // create a function to update a transaction 109 | ) => { 110 | toast.addEventListener("mouseenter", Swal.stopTimer); 111 | toast.addEventListener("mouseleave", Swal.resumeTimer); 112 | }, 113 | }); 114 | return response; 115 | } catch (err) { 116 | console.log("removeTransactionById err", err); 117 | Swal.fire({ 118 | icon: "error", 119 | text: err.response.data || "Delete transaction failed!", 120 | toast: true, 121 | position: "top", 122 | showConfirmButton: false, 123 | timer: 3000, 124 | timerProgressBar: true, 125 | didOpen: ( 126 | toast // create a function to update a transaction 127 | ) => { 128 | toast.addEventListener("mouseenter", Swal.stopTimer); 129 | toast.addEventListener("mouseleave", Swal.resumeTimer); 130 | }, 131 | }); 132 | throw Error(err.response.data || "Delete transaction failed!"); 133 | } 134 | }; 135 | // create a function to update a transaction 136 | export const updateTransactionById = async (_id, transaction) => { 137 | try { 138 | const response = await axios.put( 139 | `${baseURL}/transaction/${_id}`, 140 | transaction 141 | ); 142 | Swal.fire({ 143 | icon: "success", 144 | text: "Transaction updated successfully!", 145 | toast: true, 146 | position: "top", 147 | showConfirmButton: false, 148 | timer: 3000, 149 | timerProgressBar: true, 150 | didOpen: ( 151 | toast // create a function to update a transaction 152 | ) => { 153 | toast.addEventListener("mouseenter", Swal.stopTimer); 154 | toast.addEventListener("mouseleave", Swal.resumeTimer); 155 | }, 156 | }); 157 | return response; 158 | } catch (err) { 159 | console.log("updateTransactionById err", err); 160 | Swal.fire({ 161 | icon: "error", 162 | text: err.response.data || "Update transaction failed!", 163 | toast: true, 164 | position: "top", 165 | showConfirmButton: false, 166 | timer: 3000, 167 | timerProgressBar: true, 168 | didOpen: ( 169 | toast // create a function to update a transaction 170 | ) => { 171 | toast.addEventListener("mouseenter", Swal.stopTimer); 172 | toast.addEventListener("mouseleave", Swal.resumeTimer); 173 | }, 174 | }); 175 | throw Error(err.response.data || "Update transaction failed!"); 176 | } 177 | }; 178 | // create a function to get all transactions by user id 179 | export const getTransactionsByUserId = async (userId) => { 180 | try { 181 | const response = await axios.get(`${baseURL}/transaction/user/${userId}`); 182 | return response; 183 | } catch (err) { 184 | console.log("getTransactionsByUserId err", err); 185 | Swal.fire({ 186 | icon: "error", 187 | text: err.response.data || "Get transactions by user id failed!", 188 | toast: true, 189 | position: "top", 190 | showConfirmButton: false, 191 | timer: 3000, 192 | timerProgressBar: true, 193 | didOpen: ( 194 | toast // create a function to update a transaction 195 | ) => { 196 | toast.addEventListener("mouseenter", Swal.stopTimer); 197 | toast.addEventListener("mouseleave", Swal.resumeTimer); 198 | }, 199 | }); 200 | throw Error(err.response.data || "Get transactions by user id failed!"); 201 | } 202 | }; 203 | // create a function to get all transactions by family id 204 | export const getTransactionsByFamilyId = async (familyId) => { 205 | try { 206 | const response = await axios.get( 207 | `${baseURL}/transaction/family/${familyId}` 208 | ); 209 | return response; 210 | } catch (err) { 211 | console.log("getTransactionsByFamilyId err", err); 212 | Swal.fire({ 213 | icon: "error", 214 | text: err.response.data || "Get transactions by family id failed!", 215 | toast: true, 216 | position: "top", 217 | showConfirmButton: false, 218 | timer: 3000, 219 | timerProgressBar: true, 220 | didOpen: ( 221 | toast // create a function to update a transaction 222 | ) => { 223 | toast.addEventListener("mouseenter", Swal.stopTimer); 224 | toast.addEventListener("mouseleave", Swal.resumeTimer); 225 | }, 226 | }); 227 | throw Error(err.response.data || "Get transactions by family id failed!"); 228 | } 229 | }; 230 | // create a function to get all transactions by account id 231 | export const getTransactionsByAccountId = async (accountId) => { 232 | try { 233 | const response = await axios.get( 234 | `${baseURL}/transaction/account/${accountId}` 235 | ); 236 | return response; 237 | } catch (err) { 238 | console.log("getTransactionsByAccountId err", err); 239 | Swal.fire({ 240 | icon: "error", 241 | text: err.response.data || "Get transactions by account id failed!", 242 | toast: true, 243 | position: "top", 244 | showConfirmButton: false, 245 | timer: 3000, 246 | timerProgressBar: true, 247 | didOpen: ( 248 | toast // create a function to update a transaction 249 | ) => { 250 | toast.addEventListener("mouseenter", Swal.stopTimer); 251 | toast.addEventListener("mouseleave", Swal.resumeTimer); 252 | }, 253 | }); 254 | throw Error(err.response.data || "Get transactions by account id failed!"); 255 | } 256 | }; 257 | // create a function to get all transactions by category id 258 | export const getTransactionsByCategoryId = async (categoryId) => { 259 | try { 260 | const response = await axios.get( 261 | `${baseURL}/transaction/category/${categoryId}` 262 | ); 263 | return response; 264 | } catch (err) { 265 | console.log("getTransactionsByCategoryId err", err); 266 | Swal.fire({ 267 | icon: "error", 268 | text: err.response.data || "Get transactions by category id failed!", 269 | toast: true, 270 | position: "top", 271 | showConfirmButton: false, 272 | timer: 3000, 273 | timerProgressBar: true, 274 | didOpen: ( 275 | toast // create a function to update a transaction 276 | ) => { 277 | toast.addEventListener("mouseenter", Swal.stopTimer); 278 | toast.addEventListener("mouseleave", Swal.resumeTimer); 279 | }, 280 | }); 281 | throw Error(err.response.data || "Get transactions by category id failed!"); 282 | } 283 | }; 284 | // create a function to get all transactions by user id and family id 285 | export const getTransactionsByUserIdAndFamilyId = async (userId, familyId) => { 286 | try { 287 | const response = await axios.get( 288 | `${baseURL}/transaction/user/${userId}/family/${familyId}` 289 | ); 290 | return response; 291 | } catch (err) { 292 | console.log("getTransactionsByUserIdAndFamilyId err", err); 293 | Swal.fire({ 294 | icon: "error", 295 | text: 296 | err.response.data || 297 | "Get transactions by user id and family id failed!", 298 | toast: true, 299 | position: "top", 300 | showConfirmButton: false, 301 | timer: 3000, 302 | timerProgressBar: true, 303 | }); 304 | throw Error( 305 | err.response.data || "Get transactions by user id and family id failed!" 306 | ); 307 | } 308 | }; 309 | // create a function to get all transactions by user id and account id 310 | export const getTransactionsByUserIdAndAccountId = async ( 311 | userId, 312 | accountId 313 | ) => { 314 | try { 315 | const response = await axios.get( 316 | `${baseURL}/transaction/user/${userId}/account/${accountId}` 317 | ); 318 | return response; 319 | } catch (err) { 320 | console.log("getTransactionsByUserIdAndAccountId err", err); 321 | Swal.fire({ 322 | icon: "error", 323 | text: 324 | err.response.data || 325 | "Get transactions by user id and account id failed!", 326 | toast: true, 327 | position: "top", 328 | showConfirmButton: false, 329 | timer: 3000, 330 | timerProgressBar: true, 331 | }); 332 | throw Error( 333 | err.response.data || "Get transactions by user id and account id failed!" 334 | ); 335 | } 336 | }; 337 | // create a function to get all transactions by user id and category id 338 | export const getTransactionsByUserIdAndCategoryId = async ( 339 | userId, 340 | categoryId 341 | ) => { 342 | try { 343 | const response = await axios.get( 344 | `${baseURL}/transaction/user/${userId}/category/${categoryId}` 345 | ); 346 | return response; 347 | } catch (err) { 348 | console.log("getTransactionsByUserIdAndCategoryId err", err); 349 | Swal.fire({ 350 | icon: "error", 351 | text: 352 | err.response.data || 353 | "Get transactions by user id and category id failed!", 354 | toast: true, 355 | position: "top", 356 | showConfirmButton: false, 357 | timer: 3000, 358 | timerProgressBar: true, 359 | }); 360 | throw Error( 361 | err.response.data || "Get transactions by user id and category id failed!" 362 | ); 363 | } 364 | }; 365 | // create a function to get all transactions by user id, family id and account id 366 | export const getTransactionsByUserIdAndFamilyIdAndAccountId = async ( 367 | userId, 368 | familyId, 369 | accountId 370 | ) => { 371 | try { 372 | const response = await axios.get( 373 | `${baseURL}/transaction/user/${userId}/family/${familyId}/account/${accountId}` 374 | ); 375 | return response; 376 | } catch (err) { 377 | console.log("getTransactionsByUserIdAndFamilyIdAndAccountId err", err); 378 | Swal.fire({ 379 | icon: "error", 380 | text: 381 | err.response.data || 382 | "Get transactions by user id, family id and account id failed!", 383 | toast: true, 384 | position: "top", 385 | showConfirmButton: false, 386 | timer: 3000, 387 | timerProgressBar: true, 388 | }); 389 | throw Error( 390 | err.response.data || 391 | "Get transactions by user id, family id and account id failed!" 392 | ); 393 | } 394 | }; 395 | // create a function to get all transactions by user id, family id and category id 396 | export const getTransactionsByUserIdAndFamilyIdAndCategoryId = async ( 397 | userId, 398 | familyId, 399 | categoryId 400 | ) => { 401 | try { 402 | const response = await axios.get( 403 | `${baseURL}/transaction/user/${userId}/family/${familyId}/category/${categoryId}` 404 | ); 405 | return response; 406 | } catch (err) { 407 | console.log("getTransactionsByUserIdAndFamilyIdAndCategoryId err", err); 408 | Swal.fire({ 409 | icon: "error", 410 | text: 411 | err.response.data || 412 | "Get transactions by user id, family id and category id failed!", 413 | toast: true, 414 | position: "top", 415 | showConfirmButton: false, 416 | timer: 3000, 417 | timerProgressBar: true, 418 | }); 419 | throw Error( 420 | err.response.data || 421 | "Get transactions by user id, family id and category id failed!" 422 | ); 423 | } 424 | }; 425 | -------------------------------------------------------------------------------- /frontend/src/apis/users.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | import Swal from "sweetalert2"; 3 | import { baseURL } from "."; 4 | 5 | export const loginUser = async ({ email, password }) => { 6 | try { 7 | const response = await axios.post(`${baseURL}/user/signin`, { 8 | email, 9 | password, 10 | }); 11 | Swal.fire({ 12 | icon: "success", 13 | text: "Login successfully!", 14 | toast: true, 15 | position: "top", 16 | showConfirmButton: false, 17 | timer: 3000, 18 | timerProgressBar: true, 19 | didOpen: (toast) => { 20 | toast.addEventListener("mouseenter", Swal.stopTimer); 21 | toast.addEventListener("mouseleave", Swal.resumeTimer); 22 | }, 23 | }); 24 | return response; 25 | } catch (err) { 26 | console.log("login err", err); 27 | Swal.fire({ 28 | icon: "error", 29 | text: err.response.data || "Login failed!", 30 | toast: true, 31 | position: "top", 32 | showConfirmButton: false, 33 | timer: 3000, 34 | timerProgressBar: true, 35 | didOpen: (toast) => { 36 | toast.addEventListener("mouseenter", Swal.stopTimer); 37 | toast.addEventListener("mouseleave", Swal.resumeTimer); 38 | }, 39 | }); 40 | throw Error(err.response.data || "Login failed!"); 41 | } 42 | }; 43 | 44 | export const signUpUser = async ({ username, email, password }) => { 45 | try { 46 | const response = await axios.post(`${baseURL}/user/signup`, { 47 | name: username, 48 | email, 49 | password, 50 | }); 51 | Swal.fire({ 52 | icon: "success", 53 | text: "Profile created successfully!", 54 | toast: true, 55 | position: "top", 56 | showConfirmButton: false, 57 | timer: 3000, 58 | timerProgressBar: true, 59 | didOpen: (toast) => { 60 | toast.addEventListener("mouseenter", Swal.stopTimer); 61 | toast.addEventListener("mouseleave", Swal.resumeTimer); 62 | }, 63 | }); 64 | return response; 65 | } catch (err) { 66 | console.log("sign up errr", err); 67 | Swal.fire({ 68 | icon: "error", 69 | text: err.response.data || "Sign up failed!", 70 | toast: true, 71 | position: "top", 72 | showConfirmButton: false, 73 | timer: 3000, 74 | timerProgressBar: true, 75 | didOpen: (toast) => { 76 | toast.addEventListener("mouseenter", Swal.stopTimer); 77 | toast.addEventListener("mouseleave", Swal.resumeTimer); 78 | }, 79 | }); 80 | throw Error(err?.response?.data || "Sign up failed!"); 81 | } 82 | }; 83 | 84 | export const loadUser = async () => { 85 | try { 86 | const response = await axios.get(`${baseURL}/user/getCurrentUser`); 87 | console.log("load user", response.data); 88 | return response.data; 89 | } catch (err) { 90 | throw Error(err?.response?.data?.message || "Load user failed!"); 91 | } 92 | }; 93 | -------------------------------------------------------------------------------- /frontend/src/contexts/AuthContext.jsx: -------------------------------------------------------------------------------- 1 | import React, { useContext, useState } from "react"; 2 | 3 | const AuthContext = React.createContext(); 4 | 5 | export function useAuth() { 6 | return useContext(AuthContext); 7 | } 8 | 9 | export function AuthProvider({ children }) { 10 | const [currentUser, setCurrentUser] = useState(); 11 | const [loggedIn, setLoggedIn] = useState(false); 12 | const [token, setToken] = useState(); 13 | const [loading, setLoading] = useState(false); 14 | 15 | const value = { 16 | currentUser, 17 | setCurrentUser, 18 | loggedIn, 19 | setLoggedIn, 20 | userLoading: loading, 21 | setUserLoading: setLoading, 22 | token, 23 | setToken, 24 | }; 25 | 26 | return ( 27 | 28 | {!loading && children} 29 | 30 | ); 31 | } 32 | -------------------------------------------------------------------------------- /frontend/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /frontend/src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom/client"; 3 | import "./index.css"; 4 | 5 | // styles and bootstrap 6 | import "bootstrap/dist/css/bootstrap.min.css"; 7 | import "./styles/styles.scss"; 8 | 9 | import App from "./App"; 10 | import reportWebVitals from "./reportWebVitals"; 11 | 12 | // import BrowserRouter as Router 13 | import { BrowserRouter as Router } from "react-router-dom"; 14 | 15 | import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; 16 | import { AuthProvider } from "./contexts/AuthContext"; 17 | // Create a client 18 | const queryClient = new QueryClient(); 19 | 20 | const root = ReactDOM.createRoot(document.getElementById("root")); 21 | root.render( 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ); 32 | 33 | // If you want to start measuring performance in your app, pass a function 34 | // to log results (for example: reportWebVitals(console.log)) 35 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 36 | reportWebVitals(); 37 | -------------------------------------------------------------------------------- /frontend/src/pages/AccountsPage.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import NavbarComponent from "../Components/Common/NavbarComponent"; 3 | import { 4 | Button, 5 | Card, 6 | Col, 7 | Container, 8 | Row, 9 | Modal, 10 | Form, 11 | } from "react-bootstrap"; 12 | 13 | const AccountsPage = () => { 14 | const [bankName, setBankName] = useState(""); 15 | const [accountNumber, setAccountNumber] = useState(""); 16 | const [balance, setBalance] = useState(""); 17 | const accounts = [ 18 | { bankName: "PNB", accountNumber: "1234", balance: "$34" }, 19 | { bankName: "SBI", accountNumber: "1234", balance: "$34" }, 20 | { bankName: "HDFC", accountNumber: "1234", balance: "$34" }, 21 | ]; 22 | 23 | const [show, setShow] = useState(false); 24 | 25 | const handleClose = () => setShow(false); 26 | return ( 27 |
28 | 29 | 30 | Create Transaction 31 | 32 | 33 |
{}}> 34 | 35 | Account Name 36 | setBankName(e.target.value)} 41 | /> 42 | 43 | 44 | Account Code 45 | setAccountNumber(e.target.value)} 50 | /> 51 | 52 | 53 | Account Type 54 | setBalance(e.target.value)} 59 | /> 60 | 61 |
62 |
63 | 64 | 67 | 70 | 71 |
72 | 73 |
74 |
75 | 76 | {" "} 77 | {/*

Accounts


*/} 78 |
79 |

Accounts

80 | 81 | 84 |
85 |
86 | 87 | {" "} 88 | {accounts.map((account, index) => ( 89 | 90 | {" "} 91 | 92 | {" "} 93 | 94 | {" "} 95 | 96 |
102 |
{account.bankName}
103 |
104 | 105 |
106 |
107 |
{" "} 108 | Account Number: {account.accountNumber}{" "} 109 | Balance: {account.balance}{" "} 110 |
{" "} 111 |
{" "} 112 | 113 | ))}{" "} 114 |
{" "} 115 |
116 |
117 | ); 118 | }; 119 | 120 | export default AccountsPage; 121 | -------------------------------------------------------------------------------- /frontend/src/pages/CategoryPage.jsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from "react"; 2 | import { useAuth } from "../contexts/AuthContext"; 3 | import { TableComponent, SearchFilters } from "../Components/Finances"; 4 | import NavbarComponent from "../Components/Common/NavbarComponent"; 5 | import {getCategory} from "../apis/category.js"; 6 | import { Button } from "react-bootstrap"; 7 | import { useState } from 'react'; 8 | 9 | const Category = () => { 10 | const { currentUser, loggedIn, setLoggedIn } = useAuth(); 11 | const [search, setSearch] = useState(''); 12 | const [data, setData] = useState([]); 13 | 14 | useEffect(() => { 15 | },[]); 16 | 17 | // create on search using event value on data 18 | const onSearch = (value) => { 19 | setSearch(value); 20 | const filterData = data.filter((item) => { 21 | return item.name.toLowerCase().includes(value.toLowerCase()); 22 | }); 23 | setData(filterData); 24 | }; 25 | 26 | return ( 27 |
28 | 29 |
30 |
31 |
32 |
33 | {/* give code for search bar and filter button */} 34 | onSearch(e.target.value)} type="text" placeholder="Search..." /> 35 | 38 |
39 | 40 |
41 |
42 | ); 43 | }; 44 | 45 | export default Category; 46 | -------------------------------------------------------------------------------- /frontend/src/pages/DashboardPage.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Container, Row, Col } from "react-bootstrap"; 3 | import NavbarComponent from "../Components/Common/NavbarComponent"; 4 | import BarChart from "../Components/Chart"; 5 | import PieChart from "../Components/PieChart"; 6 | 7 | const DashboardPage = () => { 8 | return ( 9 |
10 | 11 | 12 | 13 | 14 | 15 |

Finance Tracker Dashboard

16 |

Here you can view and manage your financial data.

17 | 18 |
19 | 20 |
29 |
30 | 31 |
32 |
33 | 34 |
35 |
36 |
37 |
38 |
39 | ); 40 | }; 41 | 42 | export default DashboardPage; 43 | -------------------------------------------------------------------------------- /frontend/src/pages/FinancesPage.jsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from "react"; 2 | import { useAuth } from "../contexts/AuthContext"; 3 | import { 4 | TableComponent, 5 | SearchFilters, 6 | FinanceTable, 7 | } from "../Components/Finances"; 8 | import NavbarComponent from "../Components/Common/NavbarComponent"; 9 | import { useMutation, useQuery } from "@tanstack/react-query"; 10 | import { createTransaction, getTransactions } from "../apis/transactions"; 11 | import axios from "axios"; 12 | 13 | const FinancesPage = () => { 14 | const [amount, setAmount] = useState(""); 15 | const [transactionType, setTransactionType] = useState("income"); 16 | const [category, setCategory] = useState(""); 17 | const [date, setDate] = useState(""); 18 | const [description, setDescription] = useState(""); 19 | 20 | const [show, setShow] = useState(false); 21 | 22 | const [data, setData] = useState([ 23 | { 24 | id: 1, 25 | type: "Expense", 26 | name: "Electric Bill", 27 | date: "2023-06-15", 28 | amount: 100, 29 | category: "Utilities", 30 | }, 31 | { 32 | id: 2, 33 | type: "Income", 34 | name: "Salary", 35 | date: "2023-06-20", 36 | amount: 2000, 37 | category: "Income", 38 | }, 39 | { 40 | id: 3, 41 | type: "Expense", 42 | name: "Groceries", 43 | date: "2023-06-10", 44 | amount: 50, 45 | category: "Food", 46 | }, 47 | { 48 | id: 4, 49 | type: "Expense", 50 | name: "Internet Bill", 51 | date: "2023-06-25", 52 | amount: 80, 53 | category: "Utilities", 54 | }, 55 | { 56 | id: 5, 57 | type: "Income", 58 | name: "Freelance Work", 59 | date: "2023-06-18", 60 | amount: 500, 61 | category: "Income", 62 | }, 63 | { 64 | id: 6, 65 | type: "Expense", 66 | name: "Dinner", 67 | date: "2023-06-12", 68 | amount: 30, 69 | category: "Food", 70 | }, 71 | ]); 72 | 73 | const handleClose = () => setShow(false); 74 | 75 | const handleSubmit = async () => { 76 | try { 77 | // add transaction to the data array 78 | console.log("handleSubmit"); 79 | setData([ 80 | ...data, 81 | { 82 | id: data.length + 1, 83 | type: transactionType, 84 | name: description, 85 | date: date, 86 | amount: amount, 87 | category: category, 88 | }, 89 | ]); 90 | console.log(data); 91 | handleClose(); 92 | } catch (error) { 93 | console.log(error); 94 | } 95 | }; 96 | 97 | return ( 98 |
99 | 100 |
101 |
102 |
103 | 104 | 124 |
125 |
126 | ); 127 | }; 128 | 129 | export default FinancesPage; 130 | -------------------------------------------------------------------------------- /frontend/src/pages/Homepage.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { HeroSection, Features, Footer, LoginModal } from "../Components/Home"; 3 | import { useAuth } from "../contexts/AuthContext"; 4 | import { Navigate } from "react-router-dom"; 5 | 6 | const Homepage = () => { 7 | const { loggedIn } = useAuth(); 8 | 9 | const [show, setShow] = useState(false); 10 | 11 | const handleClose = () => setShow(false); 12 | const handleShow = () => setShow(true); 13 | 14 | if (loggedIn) { 15 | return ; 16 | } 17 | 18 | return ( 19 |
20 | 21 | 22 | 23 | 24 |
25 | 26 | {/* login modal */} 27 | 32 |
33 | ); 34 | }; 35 | 36 | export default Homepage; 37 | -------------------------------------------------------------------------------- /frontend/src/pages/NotFoundPage.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Container, Row, Col } from "react-bootstrap"; 3 | 4 | const NotFoundPage = () => { 5 | return ( 6 |
7 | 8 | 9 | 10 |

404

11 |

Page Not Found

12 |

13 | Oops! The page you are looking for does not exist. 14 |

15 | 16 |
17 |
18 |
19 | ); 20 | }; 21 | 22 | export default NotFoundPage; 23 | -------------------------------------------------------------------------------- /frontend/src/pages/index.js: -------------------------------------------------------------------------------- 1 | export { default as HomePage } from "./Homepage"; 2 | export { default as DashboardPage } from "./DashboardPage"; 3 | export { default as NotFoundPage } from "./NotFoundPage"; 4 | export { default as FinancesPage } from "./FinancesPage"; 5 | export { default as CategoryPage } from "./CategoryPage"; 6 | -------------------------------------------------------------------------------- /frontend/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /frontend/src/routes/PrivateRoutes.jsx: -------------------------------------------------------------------------------- 1 | import { Navigate, Outlet } from "react-router-dom"; 2 | 3 | const PrivateRoutes = ({ loggedIn }) => { 4 | return loggedIn ? : ; 5 | }; 6 | 7 | export default PrivateRoutes; 8 | -------------------------------------------------------------------------------- /frontend/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /frontend/src/styles/_base.scss: -------------------------------------------------------------------------------- 1 | // font 2 | @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800&display=swap"); 3 | 4 | *, 5 | *::after, 6 | *::before { 7 | margin: 0; 8 | padding: 0; 9 | box-sizing: inherit; 10 | } 11 | 12 | html { 13 | box-sizing: border-box; 14 | scroll-behavior: smooth; 15 | } 16 | 17 | body { 18 | -moz-osx-font-smoothing: grayscale; 19 | -webkit-font-smoothing: antialiased; 20 | font-family: "Poppins", sans-serif; 21 | } 22 | 23 | ::-webkit-scrollbar { 24 | width: 6px; 25 | transition: all 2s ease; 26 | } -------------------------------------------------------------------------------- /frontend/src/styles/pages/_finances.scss: -------------------------------------------------------------------------------- 1 | .finances { 2 | &-searchfilter { 3 | display: flex; 4 | align-items: center; 5 | justify-content: space-between; 6 | 7 | input { 8 | width: 75%; 9 | margin-bottom: 1rem; 10 | padding: 0.5rem; 11 | border: 1px solid #ced4da; 12 | border-radius: 0.25rem; 13 | font-size: 1rem; 14 | color: #666; 15 | background-color: #f9f9f9; 16 | transition: border-color 0.2s ease-in-out; 17 | // box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.1); 18 | &:focus { 19 | outline: none; 20 | border-color: #007bff; 21 | } 22 | 23 | } 24 | 25 | .filter-btn { 26 | width: 20%; 27 | margin-bottom: 1rem; 28 | padding: 0.5rem; 29 | border:none; 30 | border-radius: 0.35rem; 31 | font-size: 1rem; 32 | color: #fff; 33 | background-color: #007bff ; 34 | transition: border-color 0.2s ease-in-out; 35 | 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /frontend/src/styles/pages/_home.scss: -------------------------------------------------------------------------------- 1 | .home-page { 2 | display: flex; 3 | flex-direction: column; 4 | min-height: 100vh; 5 | } 6 | 7 | .jumbotron { 8 | flex: 1; 9 | display: flex; 10 | flex-direction: column; 11 | align-items: center; 12 | justify-content: center; 13 | text-align: center; 14 | // background-color: #f8f9fa; 15 | /* purple linear gradient */ 16 | // background: linear-gradient(to bottom, #6a11cb, #2575fc); 17 | // background: linear-gradient( 18 | // 45deg, 19 | // rgba(138, 43, 226, 1) 0%, 20 | // rgba(75, 0, 130, 1) 100% 21 | // ); 22 | // background: linear-gradient(to right, #667eea, #764ba2); 23 | background: linear-gradient(to right, #7b4397, #dc2430); 24 | color: #fff; 25 | padding: 2rem; 26 | flex: 4; 27 | } 28 | 29 | .features { 30 | display: grid; 31 | /* two items in one row */ 32 | grid-template-columns: repeat(2, 1fr); 33 | grid-gap: 1rem; 34 | padding: 1rem 10rem; 35 | flex: 1; 36 | font-size: 1.2rem; 37 | 38 | .feature-row { 39 | display: flex; 40 | flex-direction: row; 41 | justify-content: space-between; 42 | align-items: center; 43 | margin-bottom: 1rem; 44 | } 45 | } 46 | 47 | .feature-item { 48 | background-color: #f8f9fa; 49 | padding: 30px; 50 | border-radius: 5px; 51 | } 52 | 53 | .feature-title { 54 | font-size: 24px; 55 | font-weight: bold; 56 | margin-bottom: 10px; 57 | } 58 | 59 | .feature-description { 60 | font-size: 16px; 61 | color: #6c757d; 62 | } 63 | 64 | 65 | .footer { 66 | background-color: #f8f9fa; 67 | padding: 1rem; 68 | text-align: center; 69 | font-size: 0.8rem; 70 | color: #868e96; 71 | } -------------------------------------------------------------------------------- /frontend/src/styles/pages/_notfound.scss: -------------------------------------------------------------------------------- 1 | .not-found-page { 2 | padding: 2rem; 3 | 4 | h1 { 5 | font-size: 4rem; 6 | margin-bottom: 1rem; 7 | } 8 | 9 | h2 { 10 | font-size: 2rem; 11 | margin-bottom: 1rem; 12 | } 13 | 14 | p { 15 | font-size: 1.5rem; 16 | margin-bottom: 2rem; 17 | color: #666; 18 | text-align: center; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /frontend/src/styles/styles.scss: -------------------------------------------------------------------------------- 1 | // base.scss 2 | @import '_base'; 3 | 4 | // =========== pages =========== 5 | // _home.scss 6 | @import './pages/home'; 7 | @import './pages/finances'; 8 | // _notfound.scss 9 | @import './pages/notfound'; -------------------------------------------------------------------------------- /frontend/src/utils/chart-mock-data.js: -------------------------------------------------------------------------------- 1 | export const overallData = [ 2 | { month: "January", expense: 25678 }, 3 | 4 | { month: "February", expense: 34523 }, 5 | 6 | { month: "March", expense: 19890 }, 7 | 8 | { month: "April", expense: 20345 }, 9 | 10 | { month: "May", expense: 18456 }, 11 | 12 | { month: "June", expense: 22374 }, 13 | 14 | { month: "July", expense: 0 }, 15 | 16 | { month: "August", expense: 0 }, 17 | 18 | { month: "September", expense: 0 }, 19 | 20 | { month: "October", expense: 0 }, 21 | 22 | { month: "November", expense: 0 }, 23 | 24 | { month: "December", expense: 0 }, 25 | ]; 26 | 27 | export const DEFAULT_FILTER_LABEL = { 28 | id: "month", 29 | label: "Expense wrt. Month", 30 | }; 31 | -------------------------------------------------------------------------------- /frontend/src/utils/constants.js: -------------------------------------------------------------------------------- 1 | export const FormBuilder = { 2 | AddTransaction: [ 3 | { 4 | type: "number", 5 | name: "amount", 6 | label: "Amount", 7 | placeholder: "Enter Amount", 8 | required: true, 9 | }, 10 | { 11 | type: "select", 12 | name: "type", 13 | label: "Type", 14 | placeholder: "Enter Type", 15 | required: true, 16 | options: [ 17 | { value: 0, label: "Income" }, 18 | { value: 1, label: "Expense" }, 19 | ], 20 | }, 21 | { 22 | type: "select", 23 | name: "category", 24 | label: "Category", 25 | placeholder: "Enter Category", 26 | required: true, 27 | }, 28 | { 29 | type: "text", 30 | name: "description", 31 | label: "Description", 32 | placeholder: "Enter Description", 33 | required: true, 34 | }, 35 | { 36 | type: "date", 37 | name: "date", 38 | label: "Date", 39 | placeholder: "Enter Date", 40 | required: true, 41 | }, 42 | ], 43 | // create a new key for categories 44 | AddCategory: [ 45 | { 46 | type: "text", 47 | name: "name", 48 | label: "Name", 49 | placeholder: "Enter Name", 50 | required: true, 51 | }, 52 | { 53 | type: "text", 54 | name: "description", 55 | label: "Description", 56 | placeholder: "Enter Description", 57 | required: true, 58 | }, 59 | ], 60 | }; 61 | -------------------------------------------------------------------------------- /frontend/src/utils/pie-mock-data.js: -------------------------------------------------------------------------------- 1 | export const overallData = [ 2 | { category: 'Travel', categoryData: 10, color: '#ff6384' }, 3 | { category: 'Food', categoryData: 20, color: '#36a2eb' }, 4 | { category: 'Education', categoryData: 30, color: '#ffce56' }, 5 | { category: 'Others', categoryData: 40, color: 'red' }, 6 | ] -------------------------------------------------------------------------------- /frontend/src/utils/table-mock-data.js: -------------------------------------------------------------------------------- 1 | export const data = [ 2 | { 3 | id: 1, 4 | name: "Electric Bill", 5 | }, 6 | { id: 2, name: "Salary" }, 7 | { 8 | id: 3, 9 | name: "Groceries", 10 | }, 11 | { 12 | id: 4, 13 | name: "Internet Bill", 14 | }, 15 | { 16 | id: 5, 17 | name: "Freelance Work", 18 | }, 19 | { id: 6, name: "Dinner" }, 20 | ]; -------------------------------------------------------------------------------- /media/Architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/Architecture.png -------------------------------------------------------------------------------- /media/Chaitanya.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/Chaitanya.png -------------------------------------------------------------------------------- /media/Daya.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/Daya.png -------------------------------------------------------------------------------- /media/Gourav.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/Gourav.png -------------------------------------------------------------------------------- /media/Signin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/Signin.png -------------------------------------------------------------------------------- /media/Vipul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/Vipul.png -------------------------------------------------------------------------------- /media/accounts.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/accounts.jpg -------------------------------------------------------------------------------- /media/add-account.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/add-account.jpg -------------------------------------------------------------------------------- /media/add-category.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/add-category.jpg -------------------------------------------------------------------------------- /media/categories.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/categories.jpg -------------------------------------------------------------------------------- /media/create-transaction.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/create-transaction.jpg -------------------------------------------------------------------------------- /media/dashboard.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/dashboard.jpg -------------------------------------------------------------------------------- /media/data-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/data-model.png -------------------------------------------------------------------------------- /media/hackathon_video.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/hackathon_video.webm -------------------------------------------------------------------------------- /media/landing-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/landing-page.png -------------------------------------------------------------------------------- /media/register.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/register.png -------------------------------------------------------------------------------- /media/reports.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/reports.jpg -------------------------------------------------------------------------------- /media/transactions.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fastest-Coder-First/veersatech/49109dee160ef2126206ea048bf6bbba2110895d/media/transactions.jpg -------------------------------------------------------------------------------- /screenshots.md: -------------------------------------------------------------------------------- 1 | # Landing Page 2 | 3 | A visually appealing landing page that provides a brief overview of the project and links to the other pages. 4 | 5 | ![Landing Page](./media/landing-page.png) 6 | 7 | # Login Page 8 | A login page that allows users to login to the application 9 | ![Login Page](./media/Signin.png) 10 | 11 | # Signup Page 12 | If users don't have an account they can click on the "Sign Up" button to be redirected to the sign up page. 13 | ![Register Page](./media/register.png) 14 | 15 | # Dashboard Page 16 | 17 | Dashboard page that provides a brief overview of the user's financial status. It includes a graph that shows the user's net worth over time, a list of the user's accounts, and a list of the user's transactions. 18 | ![Dashboard Page](./media/dashboard.jpg) 19 | 20 | # Transactions Page 21 | Transactions Page that allows users to view, add, edit, and delete transactions. It also allows users to filter transactions by date, category, and account. 22 | ![Transactions Page](./media/transactions.jpg) 23 | ![Create Transaction](./media/create-transaction.jpg) 24 | 25 | 26 | # Categories Page 27 | Categoroes Page that allows users to view, add, edit, and delete categories. 28 | ![Categories Page](./media/categories.jpg) 29 | ![Create Category](./media/add-category.jpg) 30 | 31 | 32 | # Accounts Page 33 | Accounts Page that allows users to view, add, edit, and delete accounts. 34 | ![Accounts Page](./media/accounts.jpg) 35 | ![Create Account](./media/add-account.jpg) 36 | 37 | # Reports Page 38 | Reports Page that allows users to view reports of their income and expenses over time. 39 | ![Reports Page](./media/reports.jpg) 40 | 41 | # Demo Video 42 | [Demo Video](./media/hackathon_video.webm) 43 | 44 | 45 | -------------------------------------------------------------------------------- /userguide.md: -------------------------------------------------------------------------------- 1 | # Personal Finance Tracker User Guide 2 | 3 | Welcome to the Personal Finance Tracker user guide! This guide will walk you through the various features and functionalities of the application, helping you manage your income, expenses, categories, and accounts effectively. 4 | 5 | ## Features 6 | Following are the key features of the Personal Finance Tracker application: 7 | - Easy and intutive user interface for add and managing expenses and income transactions 8 | - Define categories for transactions as per your needs - for example, you can create categories like "Food", "Travel", "Salary", etc. 9 | - Create accounts to track your balance and transactions - for example, you can create accounts like "Cash", "Credit Card", "Bank Account", etc. 10 | - Generate reports to get insights into your spending patterns and income sources 11 | - Manage your profile and settings 12 | - Secure login and registration 13 | - Responsive design for mobile and desktop devices 14 | - Multi-Tenant support - you can create multiple families and family memmbers can manage their own customized transactions, categories, and accounts etc. 15 | 16 | ![Landing Page](./media/landing-page.png) 17 | 18 | ## Sections 19 | 20 | Personal Finance Tracker is divided into the following sections: 21 | 22 | 1. [Dashboard](#dashboard) 23 | 2. [Transactions](#transactions) 24 | 3. [Categories](#categories) 25 | 4. [Accounts](#accounts) 26 | 5. [Reports](#reports) 27 | 6. [Settings](#settings) 28 | 29 | ## Dashboard 30 | 31 | The dashboard provides an overview of your financial information. It displays your current balance, income, expenses, and may include charts or graphs representing your spending patterns. Use the dashboard to get a quick snapshot of your financial situation. 32 | ![Dashboard Page](./media/dashboard.jpg) 33 | 34 | ## Transactions 35 | 36 | The transactions feature allows you to add, edit, and delete income and expense entries. You can categorize each transaction to keep track of your spending habits and income sources. Here's how you can use the transactions feature: 37 | 38 | 1. **View Transactions:** Navigate to the Transactions page to see a list of all your transactions, including their descriptions, amounts, and types (income or expense). 39 | 2. **Add Transaction:** Click on the "Add Transaction" button to create a new income or expense entry. Enter the necessary details, such as description, amount, and category. 40 | 3. **Edit Transaction:** To modify an existing transaction, click on the edit icon or the transaction itself. Update the necessary fields and save the changes. 41 | 4. **Delete Transaction:** If you want to remove a transaction, locate the delete icon next to the transaction and confirm the deletion. 42 | ![Transactions Page](./media/transactions.jpg) 43 | 44 | 45 | 46 | ## Categories 47 | 48 | The categories feature allows you to manage and organize your transaction categories. You can create, edit, and delete categories to classify your income and expenses. Follow these steps to work with categories: 49 | 50 | 1. **View Categories:** Access the Categories page to see a list of all your categories, along with their names and parent categories (if applicable). 51 | 2. **Add Category:** Click on the "Add Category" button to create a new category. Provide a name for the category and, if needed, select a parent category to create a hierarchy. 52 | 3. **Edit Category:** To modify a category, locate the edit icon or the category itself. Update the name or parent category as required and save the changes. 53 | 4. **Delete Category:** If you want to remove a category, find the delete icon next to the category and confirm the deletion. Note that deleting a category may affect associated transactions. 54 | ![Categories Page](./media/categories.jpg) 55 | 56 | ## Accounts 57 | 58 | The accounts feature enables you to manage your financial accounts, such as bank accounts, credit cards, or cash. You can add, edit, and delete accounts, as well as track transactions associated with each account. Here's how to work with accounts: 59 | 60 | 1. **View Accounts:** Go to the Accounts page to see a list of all your accounts, including their names, current balances, and currencies. 61 | 2. **Add Account:** Click on the "Add Account" button to create a new account. Enter a name for the account, specify the initial balance, and select the currency. 62 | 3. **Edit Account:** To modify an existing account, locate the edit icon or the account itself. Update the name, balance, or currency as necessary and save the changes. 63 | 4. **Delete Account:** If you want to remove an account, find the delete icon next to the account and confirm the deletion. Note that deleting an account may affect associated transactions. 64 | ![Accounts Page](./media/accounts.jpg) 65 | 66 | ## Reports 67 | 68 | The reports feature allows you to generate various reports related to your financial data. You can generate expense reports, income reports, category-wise spending reports, and more. Follow these steps to generate reports: 69 | 70 | 1. **Select Report Type:** Navigate to the Reports page and choose the type of report you want to generate, such as expense report or income report. 71 | 2. **Set Filters (Optional):** If needed, set filters to refine the report results. For example, you can specify a date range or select specific categories. 72 | 3. **Generate Report:** Click on the "Generate Report" button to generate the report based on your selections. 73 | 4. **View and Export:** Once the report is generated, you can view it on the screen and, if desired, export it to a file format like PDF or CSV. 74 | ![Reports Page](./media/reports.jpg) 75 | 76 | ## Settings 77 | 78 | The settings feature allows you to manage your account settings and preferences. You can update your profile information, change passwords, and modify notification preferences. Follow these steps to access and modify your settings: 79 | 80 | 1. **Access Settings:** Click on the "Settings" option in the menu to navigate to the Settings page. 81 | 2. **Update Profile:** Update your profile information, such as username and email address, if necessary. 82 | 3. **Change Password:** If you want to change your password, locate the "Change Password" section and follow the instructions to set a new password. 83 | 4. **Notification Preferences:** Modify your notification preferences, such as email notifications or app notifications, based on your preferences. 84 | 85 | Congratulations! You are now familiar with the various features of the Personal Finance Tracker application. Start managing your income, expenses, categories, and accounts efficiently to take control of your finances! 86 | 87 | ## Following features are planned for future releases 88 | - Offline support 89 | - PWA support 90 | - Dark mode 91 | - Multi-language support 92 | - Multi-currency support 93 | 94 | 95 | If you have any further questions or need assistance, please reach out to our [development team](./README.md#development-team). 96 | 97 | 98 | Enjoy using the Personal Finance Tracker! 99 | 100 | --------------------------------------------------------------------------------