-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocument.html
More file actions
1436 lines (1234 loc) Β· 51.7 KB
/
document.html
File metadata and controls
1436 lines (1234 loc) Β· 51.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HEB Layout Completo</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/devicon.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.autor-wrapper {
margin-top: 2rem;
padding: 1.5rem;
background: #b8b8c5;
border-left: 5px solid #007bff;
border-radius: 12px;
box-shadow: 0 0 10px rgba(0,0,0,0.04);
animation: fadeIn 0.6s ease;
}
.autor-info {
display: flex;
align-items: center;
margin-bottom: 1.5rem;
gap: 1rem;
}
.autor-foto {
width: 80px;
height: 80px;
border-radius: 50%;
border: 3px solid #007bff;
object-fit: cover;
}
.autor-detalhes h3 {
margin: 0;
font-size: 1.3rem;
color: #0056b3;
}
.autor-detalhes a {
color: #0056b3;
text-decoration: none;
}
.autor-detalhes p {
margin: 0.3rem 0 0;
color: #000000;
}
.motivo-uso h3 {
color: #004a8f;
font-size: 1.2rem;
margin-bottom: 0.8rem;
}
.motivo-uso ul {
list-style: none;
padding-left: 1rem;
margin-bottom: 1rem;
}
.motivo-uso ul li {
position: relative;
margin-bottom: 0.6rem;
padding-left: 1.2rem;
color: #333;
}
.motivo-uso ul li::before {
content: 'β';
position: absolute;
left: 0;
color: #00b7ff;
font-weight: bold;
}
.oqeh p {
font-size: 1.1rem;
line-height: 1.8;
color: var(--text);
margin-bottom: 1rem;
}
.oqeh ul {
margin-left: 1.2rem;
padding-left: 1rem;
list-style: none;
}
.oqeh ul li {
margin-bottom: 0.6rem;
padding-left: 1.2rem;
position: relative;
color: var(--text-light);
}
.oqeh ul li::before {
content: 'β';
position: absolute;
left: 0;
color: var(--accent-hover);
font-weight: bold;
}
.tag {
background-color: rgba(58, 134, 255, 0.1);
color: var(--accent-hover);
padding: 2px 8px;
border-radius: 6px;
font-size: 0.85rem;
font-weight: 500;
margin: 0 4px;
}
.oqeh code {
background: rgba(255, 255, 255, 0.1);
padding: 2px 6px;
border-radius: 4px;
font-family: 'Courier New', monospace;
color: #00b7ff;
}
.heb-bar {
overflow-y: auto;
max-height: 100vh;
scrollbar-width: thin; /* Firefox */
scrollbar-color: #ccc transparent;
}
.heb-bar::-webkit-scrollbar {
width: 6px;
}
.heb-bar::-webkit-scrollbar-thumb {
background-color: #aaa;
border-radius: 6px;
}
.upcoming-feature a {
position: relative;
opacity: 0.8;
}
.upcoming-badge {
background-color: var(--accent-hover);
color: white;
font-size: 0.7rem;
padding: 2px 6px;
border-radius: 10px;
margin-left: 8px;
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { opacity: 0.6; }
50% { opacity: 1; }
100% { opacity: 0.6; }
}
.upcoming-feature a:hover {
opacity: 1;
}
.type-section {
margin-bottom: 2rem;
padding: 1rem;
background: rgba(0, 123, 255, 0.05);
border-radius: 8px;
border-left: 3px solid #007bff;
}
.type-section h3 {
color: #0056b3;
margin-top: 0;
}
.type-example {
background: #f8f9fa;
padding: 1rem;
border-radius: 8px;
margin: 1.5rem 0;
}
.language-typescript {
font-family: 'Courier New', monospace;
font-size: 0.9rem;
}
.upcoming-feature-notice {
background: rgba(44, 62, 80, 0.1);
border-left: 4px solid #2c3e50;
padding: 12px;
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 10px;
}
.upcoming-feature-notice i {
color: #2c3e50;
font-size: 1.2rem;
}
.upcoming-feature-notice p {
margin: 0;
color: #2c3e50;
font-weight: 500;
}
</style>
</head>
<body>
<nav class="heb-navbar">
<div class="heb-container">
<div class="heb-logo">
<span>github</span>framework
</div>
<div class="heb-search">
<input type="text" id="searchInput" placeholder="search...">
<button id="searchButton"><i class="fas fa-search"></i></button>
</div>
<a href="https://github.com/LuisOtavio13/github-framework-documentation" target="_blank" class="heb-github">
<i class="fab fa-github"></i> GitHub
</a>
</div>
</nav>
<div class="container">
<nav class="heb-bar">
<div class="logo">
</div>
<ul class="heb-menu">
<li><a href="#" data-target="inicio" class="active"><i class="fas fa-home"></i><span>Start</span></a></li>
<li><a href="#" data-target="instalacao"><i class="fas fa-download"></i><span>Installation</span></a></li>
<li><a href="#" data-target="changelog"><i class="fas fa-sync"></i><span>Changelog</span></a></li>
<li class="submenu">
<a href="#" class="toggle-submenu">
<i class="fas fa-rocket"></i><span>Starting to use</span>
<i class="fas fa-chevron-down chevron-icon"></i>
</a>
<ul class="sub-list">
<li><a href="#" data-target="conceito-instancia">π§ Instantiating Explorer</a></li>
<li><a href="#" data-target="conceito-api">π‘ Connecting to the GitHub API</a></li>
<li><a href="#" data-target="conceito-modular">π Modular Structure</a></li>
<li><a href="#" data-target="conceito-visualizacao">π Data Visualization</a></li>
<li><a href="#" data-target="conceito-autenticacao">π Authentication via Token</a></li>
</ul>
</li>
<li><a href="#" data-target="conceito-erros">π¨ Error handling with examples</a></li>
<li><a href="#" data-target="conceito-performance">π Performance and limitations of the API</a></li>
<li class="upcoming-feature">
<a href="#" data-target="gitlab-integration" title="Coming in v1.1.0">
<i class="fab fa-gitlab"></i>
<span style="border-bottom: 1px dotted var(--accent-hover);">GitLab Integration</span>
<span class="upcoming-badge">Soon</span>
</a>
</li>
<li class="upcoming-feature">
<a href="#" data-target="typescript-types" title="Coming in v1.1.0">
<i class="devicon-typescript-plain colored"></i>
<span style="border-bottom: 1px dotted var(--accent-hover);">TypeScript Support</span>
<span class="upcoming-badge">Soon</span>
</a>
</li>
</ul>
</nav>
<div id="inicio" class="conteudo-lateral active">
<h2>π§ What is the GitHub Explorer Framework?</h2>
<div class="oqeh">
<p>
<strong>GitHub Explorer Framework</strong> is a <span class="tag">visual</span>,
<span class="tag">analytical</span> and <span class="tag">modular</span> framework built on top of
<code>GitHubAPIHelper</code>, created to <strong>explore</strong>,
<strong>visualize</strong> and <strong>understand public GitHub data</strong>.
</p>
<p>
It provides a layer of <strong>dynamic dashboard</strong> that allows developers, analysts,
open-source maintainers, and educators to analyze information from profiles, repositories, languages, and contributions
with high precision and ease.
</p>
<p>
It is possible to integrate it with libraries such as <code>Chart.js</code>, <code>D3.js</code> and <code>DataTables</code> to create
responsive charts, reports, and visualizations optimized for SEO.
</p>
<ul>
<li>π¦ Modular and expandable with pure JavaScript or modern frameworks</li>
<li>π Full support for interactive charts</li>
<li>π Friendly URLs and configurable by query string (ex: <code>?user=octocat</code>)</li>
<li>π Optimized for use as a <strong>single page application</strong> or embedded</li>
</ul>
</div>
<div class="novidades-box">
<div class="novidade-header">
<i class="fas fa-bullhorn"></i>
<h3>π What's new in the version 1.1.0</h3>
</div>
<div class="novidade-item ts-support">
<div class="novidade-icon">
<i class="fab fa-typescript"></i>
</div>
<div class="novidade-content">
<h4>Official TypeScript Support!</h4>
<p>Now the framework includes complete typing for better development and intelligent autocompletion.</p>
<div class="novidade-meta">
<span class="tag ts-tag">v2.0+</span>
<span class="tag feature-tag">New</span>
</div>
</div>
</div>
</div>
<div class="autor-wrapper">
<div class="autor-info">
<img src="https://github.com/LuisOtavio13.png" alt="Foto do autor" class="autor-foto">
<div class="autor-detalhes">
<h3>π¨βπ» Created by <a href="https://github.com/LuisOtavio13" target="_blank">@LuisOtavio13</a></h3>
<p>Developer passionate about Open Source, data, and tools that empower the technical community.</p>
</div>
</div>
<div class="motivo-uso">
<h3>π€ Why use the GitHub Explorer Framework?</h3>
<ul>
<li>π <strong>Visualize complex data</strong> in a simple and interactive way.</li>
<li>βοΈ <strong>Extendable with JavaScript, Chart.js, and REST APIs</strong>.</li>
<li>π <strong>Great for dashboards, reports, and technical education</strong>.</li>
<li>π§© Based on reusable modules with a focus on <code>best practices</code>.</li>
<li>π Allows <strong>monitoring of activity</strong>, <strong>languages</strong>, and <strong>contributions</strong> of any user or public repository.</li>
</ul>
<p>The GitHub Explorer Framework was born out of the need for a practical, modular, and reusable solution to integrate and facilitate the use of various APIs, with a special focus on collaborative environments such as communities, bootcamps, open-source teams, and technical mentoring.</p>
</div>
</div>
<div class="funcionalidades-box">
<h2>π Main Features</h2>
<div class="features-grid">
<div class="feature-card">
<i class="fas fa-code-branch"></i>
<h4>Repository Analysis</h4>
<p>Explore forks, stars, issues, pull requests, and contributors in any public repository.</p>
</div>
<div class="feature-card">
<i class="fas fa-user"></i>
<h4>Profile Visualization</h4>
<p>Get details like followers, bio, most used languages, and top repositories of any user.</p>
</div>
<div class="feature-card">
<i class="fas fa-chart-pie"></i>
<h4>Interactive Dashboard</h4>
<p>Use charts with Chart.js, D3.js, or ECharts to create custom and responsive views of the data.</p>
</div>
<div class="feature-card">
<i class="fas fa-plug"></i>
<h4>API Modular</h4>
<p>Consume GitHub data using reusable modules, with full support for modern TypeScript and JavaScript.</p>
</div>
<div class="feature-card">
<i class="fas fa-search"></i>
<h4>Advanced Filters</h4>
<p>Filter data by language, dates, contributors, commit types, or topics for precise analyses.</p>
</div>
<div class="feature-card">
<i class="fas fa-tools"></i>
<h4>Easy to Use</h4>
<p>The framework is designed to make programming easier and safer.</p>
</div>
</div>
</div>
<div class="exemplos-uso">
<h2>π Quick Usage Examples</h2>
<div class="exemplo-codigo">
<h4>π Search for user information</h4>
<pre><code class="language-js">
// Importing the main module
import { GitHubUserService } from 'github-framework';
// Creating instance and fetching user data
const userService = new GitHubUserService();
userService.getUser('octocat').then(user => {
console.log(user.name); // The Octocat
console.log(user.publicRepos); // 8
});
</code></pre>
</div>
<div class="exemplo-codigo">
<h4>π¦ List user repositories</h4>
<pre><code class="language-js">
import { GitHubRepoService } from 'github-framework';
const repoService = new GitHubRepoService();
repoService.getUserRepos('octocat').then(repos => {
repos.forEach(repo => console.log(repo.name));
});
</code></pre>
</div>
<div class="exemplo-codigo">
<h4>π View used languages with graph</h4>
<pre><code class="language-js">
import { GitHubLanguageService } from 'github-framework';
import Chart from 'chart.js/auto';
const langService = new GitHubLanguageService();
langService.getLanguagesByUser('octocat').then(data => {
new Chart(document.getElementById('grafico'), {
type: 'doughnut',
data: {
labels: Object.keys(data),
datasets: [{
data: Object.values(data),
backgroundColor: ['#f1e05a', '#563d7c', '#3572A5']
}]
}
});
});
</code></pre>
<canvas id="grafico" width="300" height="300"></canvas>
</div>
</div>
<div class="arquitetura-box">
<h2>π§© Architecture and Technologies</h2>
<div class="arquitetura-explicacao">
<p>The <strong>GitHub Explorer Framework</strong> is designed to be modular, extensible, and easy to integrate with other analytical and visual tools. It follows the principles of <span class="tag">Clean Architecture</span> and <span class="tag">Separation of Concerns</span>.</p>
<ul>
<li>π§ <strong>Service Layer:</strong> Communication with the <code>GitHub REST API</code> encapsulated in reusable modules.</li>
<li>π¨ <strong>Presentation Layer:</strong> Dynamic dashboards, widgets, reusable HTML/CSS components.</li>
<li>π <strong>Analysis Layer:</strong> Data grouping, counting by author, language, period, and event type.</li>
<li>π <strong>SPA Support:</strong> Can be used as a Single Page Application with navigation via pure JavaScript.</li>
</ul>
<p>The architecture is divided into the following main modules:</p>
<div class="tech-table">
<table>
<thead>
<tr>
<th>Module</th>
<th>Responsibility</th>
<th>Technologies</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>UserService</code></td>
<td>Fetch and process user profile data</td>
<td>Fetch API, JS, GitHub API v3</td>
</tr>
<tr>
<td><code>RepoService</code></td>
<td>List and filter repositories</td>
<td>Axios, JSON, Lodash</td>
</tr>
<tr>
<td><code>CommitService</code></td>
<td>Collect and analyze commits by author/date</td>
<td>Date-fns, Chart.js</td>
</tr>
<tr>
<td><code>LanguageService</code></td>
<td>Map and display languages</td>
<td>D3.js, REST API</td>
</tr>
<tr>
<td><code>ActivityService</code></td>
<td>Analyze user events and interactions</td>
<td>Webhooks GitHub, Vue/React (optional)</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="changelog" class="conteudo-lateral">
<h2><i class="fas fa-sync"></i> Changelog</h2>
<div class="changelog-wrapper">
<div class="versao-box upcoming">
<div class="versao-header">
<span class="versao-tag">1.1.0</span>
<span class="versao-data">Shortly</span>
<span class="upcoming-badge">NOT RELEASED</span>
</div>
<ul class="versao-lista">
<li><span class="tipo-add">ADDED</span> add support for GitLab integration</li>
<li><span class="tipo-add">ADDED</span> Fallback data system when API fails</li>
<li><span class="tipo-add">ADDED</span> GraphQL support for contributions</li>
<li><span class="tipo-fix">FIXED</span> Error handling with detailed messages</li>
<li><span class="tipo-update">UPDATED</span> TypeScript definitions for all services</li>
</ul>
</div>
<!-- VersΓ£o 1.0.0 -->
<div class="versao-box">
<div class="versao-header">
<span class="versao-tag">1.0.0</span>
<span class="versao-data">2025-07-19</span>
</div>
<ul class="versao-lista">
<li><span class="tipo-add">ADDED</span> Initial release: Web dashboard UI</li>
<li><span class="tipo-add">ADDED</span> Modular service classes (Users, Repos, Commits)</li>
<li><span class="tipo-add">ADDED</span> Example usage and Jest tests</li>
</ul>
</div>
</div>
</div>
<div id="instalacao" class="conteudo-lateral">
<h3>π¦ Installing the GitHub Explorer Framework</h3>
<div class="oqeh">
<p>
To get started with the <strong>GitHub Explorer Framework</strong>, you can install it using <code>npm</code>, <code>yarn</code>, or import it via <code>CDN</code> directly in the browser.
</p>
<hr>
<h4>π§° Installation via NPM</h4>
<pre><code class="bash">npm install github-framework</code></pre>
<hr>
<h4>π§° Installation via Yarn</h4>
<pre><code class="bash">yarn add github-api-framework</code></pre>
<hr>
<h4>π Usage with CDN</h4>
<pre><code class="html"><script src="https://cdn.jsdelivr.net/npm/github-api-framework@latest/dist/github.min.js"></script></code></pre>
<hr>
<h4>π Importing into the Project</h4>
<ul>
<li><strong>ESModules:</strong> <code>import { GitHubExplorer } from 'github-api-framework'</code></li>
<li><strong>CommonJS:</strong> <code>const { GitHubExplorer } = require('github-api-framework')</code></li>
<li><strong>Global (CDN):</strong> <code>window.GitHubExplorer</code></li>
</ul>
<hr>
<h4>π§ͺ Prerequisites</h4>
<ul>
<li>β
Node.js <code>>= 18.x</code></li>
<li>β
Modern browser (Chrome, Edge, Firefox)</li>
<li>β
Code editor (VSCode, WebStorm, etc.)</li>
</ul>
<hr>
<h4>π Authentication with Token (optional)</h4>
<p>
To avoid anonymous request limits on the GitHub API, you can use a personal access token:
</p>
<pre><code class="js">
const explorer = new GitHubExplorer({
token: "ghp_seuTokenAqui"
});
</code></pre>
<p>
Generate your token at: <a href="https://github.com/settings/tokens" target="_blank">github.com/settings/tokens</a>
</p>
<hr>
<h4>π§― Common Errors</h4>
<ul>
<li>β <strong>403:</strong> API rate limit β add a token</li>
<li>β <strong>"GitHubExplorer is not defined":</strong> CDN script not loaded correctly</li>
<li>β <strong>Import error:</strong> check if your bundler supports ESModules</li>
</ul>
<hr>
<h4>π Observations</h4>
<ul>
<li>π‘ Full support for modern frameworks: React, Vue, Svelte, Next.js, Astro</li>
<li>π οΈ TypeScript support will be included in future versions</li>
<li>π§ Open source licensed under <strong>GPL</strong></li>
</ul>
</div>
</div>
<div id="produtos" class="conteudo-lateral">
<h2><i class="fas fa-box-open"></i> Our Products</h2>
<div class="card-grid">
<div class="card" data-search="eletrΓ΄nicos">Electronics</div>
<div class="card" data-search="roupas">Clothing</div>
<div class="card" data-search="acessΓ³rios">Accessories</div>
</div>
</div>
<div id="servicos" class="conteudo-lateral">
<h2><i class="fas fa-cogs"></i> Services</h2>
<ul class="servicos-lista">
<li class="heb-item" data-search="web design"><i class="fas fa-check"></i> Web Design</li>
<li class="heb-item" data-search="desenvolvimento"><i class="fas fa-check"></i> Development</li>
<li class="heb-item" data-search="consultoria"><i class="fas fa-check"></i> Consulting</li>
</ul>
</div>
<div id="contato" class="conteudo-lateral">
<h2><i class="fas fa-envelope"></i> Contact</h2>
<form class="contato-form">
<input type="text" placeholder="Your name">
<input type="email" placeholder="Email">
<textarea placeholder="Message"></textarea>
<button type="submit">Send <i class="fas fa-paper-plane"></i></button>
</form>
</div>
</div>
<div id="conceito-instancia" class="conteudo-lateral">
<h2>π§ Instantiating the Explorer</h2>
<div class="oqeh">
<p>
To start using the <strong>GitHub Explorer Framework</strong>, the first step is to instantiate the main object
of the library: <code>GitHubExplorer</code>.
</p>
<p>You can do this simply, directly in your JavaScript code:</p>
<h4>π¦ Basic Mode (no authentication)</h4>
<pre><code class="js">const explorer = new GitHubExplorer();</code></pre>
<p>
This mode allows you to explore public GitHub data, but is subject to the API's anonymous request limits
(<strong>60 requests per hour</strong>).
</p>
<h4>π Authentication Mode (personal token)</h4>
<pre><code class="js">
const explorer = new GitHubExplorer({
token: "ghp_yourTokenHere"
});
</code></pre>
<p>
Using a token is highly recommended to avoid limitations. You can generate a token at:
<a href="https://github.com/settings/tokens" target="_blank">github.com/settings/tokens</a>
</p>
<h4>π― Advanced Mode (with extra settings)</h4>
<pre><code class="js">
const explorer = new GitHubExplorer({
token: "ghp_yourTokenHere",
cache: true, // activates local cache
log: true, // shows logs in console
baseUrl: "https://api.github.com" // custom endpoint if needed
});
</code></pre>
<h4>π Checking the instance</h4>
<pre><code class="js">
console.log(explorer);
// Should show available methods: getUser, getRepos, getLanguages, etc.
</code></pre>
<p>
Once the instance is ready, you can use all the framework's features, such as searching users,
repositories and GitHub statistics.
</p>
<ul>
<li>β
Single instance for the entire application</li>
<li>β
Can be stored in global context, like <code>window.explorer</code></li>
<li>β
Reusable in any modern framework (React, Vue, etc)</li>
</ul>
</div>
</div>
<div id="conceito-api" class="conteudo-lateral">
<h2>π‘ Connecting to GitHub API</h2>
<div class="oqeh">
<p>
The <strong>GitHub Explorer Framework</strong> allows direct connection to GitHub's public API to search for information about users,
repositories, organizations, contributions and much more.
</p>
<h4>β
Instantiating with authentication (recommended)</h4>
<pre><code class="js">
import { GitHubExplorer } from 'github-framework';
const explorer = new GitHubExplorer({
token: "ghp_yourTokenHere"
});
</code></pre>
<p>
If you choose not to use an authentication token, the framework will still work. However, GitHub's API will apply stricter request limits (60 per hour).
</p>
<h4>π Where can I get my token?</h4>
<p>
Go to <a href="https://github.com/settings/tokens" target="_blank">github.com/settings/tokens</a>, click on "Generate new token",
select the desired scopes (read-only for basic use) and generate your personal token.
</p>
<h4>π§ͺ Example without authentication</h4>
<pre><code class="js">
const explorer = new GitHubExplorer(); // Without token
explorer.getUser("octocat").then(user => {
console.log(user.name, user.bio);
});
</code></pre>
<h4>π Avoid exposing tokens on the frontend!</h4>
<p>
In production projects, store the token in environment variables and use it on the backend. Public tokens in the browser can be easily
captured by malicious users.
</p>
<h4>π Tip: Free GitHub tokens</h4>
<p>
Free GitHub users can generate unlimited tokens, and expired tokens can be renewed at any time.
</p>
</div>
</div>
<div id="conceito-modular" class="conteudo-lateral">
<h2>π§© Modular Structure</h2>
<div class="oqeh">
<p>
The <strong>GitHub Explorer Framework</strong> is developed with a <span class="tag">modular architecture</span> and <span class="tag">service-oriented</span> approach, providing scalability, reusability, and code clarity. Each functionality is separated into independent modules, making selective use and integration with any modern stack easier.
</p>
<h4>π¦ Main available modules:</h4>
<ul>
<li><code>GitHubUser</code> β Works with user data</li>
<li><code>GitHubRepo</code> β Queries and filters repositories</li>
<li><code>GitHubOrg</code> β Manages organization data</li>
<li><code>GitHubLang</code> β Detects and analyzes languages</li>
<li><code>GitHubStats</code> β Aggregated statistics for dashboards</li>
<li><code>GitHubActivity</code> β Histories of commits, events, and PRs</li>
</ul>
<h4>π οΈ Example of modular usage</h4>
<pre><code class="js">import { GitHubExplorer, GitHubUser, GitHubRepo } from 'github-framework';
const explorer = new GitHubExplorer({ token: "ghp_yourTokenHere" });
const user = new GitHubUser(explorer);
const repo = new GitHubRepo(explorer);
user.getProfile('octocat').then(console.log);
repo.listByUser('octocat').then(console.log);</code></pre>
<h4>π Advantages of modularity</h4>
<ul>
<li>π Simple maintenance: each module can evolve independently</li>
<li>β‘ Performance: use only the modules you need</li>
<li>π± Extensibility: create your own modules based on <code>GitHubService</code></li>
<li>π§ͺ Ease of testing: modules are independent</li>
</ul>
<h4>ποΈ Internal Architecture (Layers)</h4>
<ul>
<li><code>GitHubExplorer</code> β Central instance with global configs (token, cache, headers)</li>
<li><code>GitHubRequest</code> β Makes direct requests to the API (fetch + error handlers)</li>
<li><code>GitHubCache</code> β Stores temporary responses locally</li>
<li><code>GitHubService</code> β Base for all modules (inherited by <code>GitHubUser</code>, etc)</li>
</ul>
<h4>π‘ Example of custom extension:</h4>
<pre><code class="js">import { GitHubService } from 'github-framework';
class GitHubPinnedRepos extends GitHubService {
async getPinnedRepos(username) {
return this.request(`/users/${username}/repos?sort=pinned`);
}
}</code></pre>
<h4>π Observations:</h4>
<ul>
<li>πΌ The architecture follows SOLID principles</li>
<li>π¦ Modules are compatible with tree-shaking</li>
<li>π§± Ready-to-use support for SPA, SSR, and JAMStack</li>
</ul>
</div>
</div>
<div id="conceito-visualizacao" class="conteudo-lateral">
<h2>π Data Visualization</h2>
<div class="oqeh">
<p>
The <strong>GitHub Explorer Framework</strong> makes it easy to create interactive and visual dashboards using libraries like <code>Chart.js</code>, <code>D3.js</code>, <code>Recharts</code>, or any other based on <code>SVG</code> or <code>Canvas</code>.
</p>
<h4>π¦ Prerequisites</h4>
<ul>
<li><code>Chart.js</code> installed via CDN or npm</li>
<li>DOM with <code><canvas></code> to render the charts</li>
<li>Calls with the <code>GitHubExplorer</code> to fetch data</li>
</ul>
<h4>π Example 1 β Most used languages by a user (Chart.js)</h4>
<p>This chart shows the distribution of languages across all public repositories of a user.</p>
<pre><code class="html"><canvas id="langChart" width="400" height="400"></canvas></code></pre>
<pre><code class="js">import { GitHubExplorer, GitHubLang } from 'github-framework';
import Chart from 'chart.js/auto';
const explorer = new GitHubExplorer({ token: 'ghp_seuTokenAqui' });
const langService = new GitHubLang(explorer);
async function gerarGraficoLinguagens(usuario) {
const dados = await langService.getLanguagesByUser(usuario);
const labels = Object.keys(dados);
const valores = Object.values(dados);
new Chart(document.getElementById('langChart'), {
type: 'doughnut',
data: {
labels,
datasets: [{
label: 'Linguagens',
data: valores,
backgroundColor: ['#3b82f6', '#22c55e', '#eab308', '#ef4444'],
}]
}
});
}
gerarGraficoLinguagens('octocat');</code></pre>
<h4>π Example 2 β Activity by Month (Commits / PRs)</h4>
<p>This shows a bar chart with the number of events per month.</p>
<pre><code class="html"><canvas id="atividadeChart"></canvas></code></pre>
<pre><code class="js">import { GitHubActivity } from 'github-api-framework';
const activity = new GitHubActivity(explorer);
async function gerarGraficoAtividade(usuario) {
const eventos = await activity.getMonthlyActivity(usuario);
const meses = Object.keys(eventos);
const valores = Object.values(eventos);
new Chart(document.getElementById('atividadeChart'), {
type: 'bar',
data: {
labels: meses,
datasets: [{
label: 'Eventos GitHub',
data: valores,
backgroundColor: '#6366f1'
}]
}
});
}
gerarGraficoAtividade('octocat');</code></pre>
<h4>π Tip: CDN for Chart.js</h4>
<pre><code class="html"><script src="https://cdn.jsdelivr.net/npm/chart.js"></script></code></pre>
<h4>π‘ Other visualization possibilities:</h4>
<ul>
<li>π Visualization of collaborators by repository</li>
<li>π Comparison of stars/forks between projects</li>
<li>π Weekly/monthly activity of the user</li>
<li>π NNumber of repositories by language</li>
</ul>
<h4>π Data response pattern:</h4>
<pre><code class="js">{
javascript: 12,
python: 4,
html: 3,
css: 2
}</code></pre>
<h4>π§ Tip for dashboards:</h4>
<ul>
<li>π Update data by typing <code>?user=nome</code> in the URL</li>
<li>π² Make the dashboard responsive with media queries</li>
<li>βοΈ Combine with libraries like <code>DataTables</code> or <code>D3.js</code> for more control</li>
</ul>
</div>
</div>
<div id="conceito-autenticacao" class="conteudo-lateral">
<h2>π Token Authentication</h2>
<div class="oqeh">
<p>
GitHub imposes <strong>limits on anonymous requests</strong> (without authentication), usually <code>60 requests per hour</code> per IP.
For more robust applications, the use of a <strong>Personal Access Token (PAT)</strong> is recommended.
</p>
<h4>π Advantages of authentication:</h4>
<ul>
<li>π Increases the limit to up to <code>5,000 requests per hour</code></li>
<li>π‘οΈ Prevents blocks due to excessive access (403 Rate Limit)</li>
<li>π§ Allows access to private data (if authorized)</li>
</ul>
<h4>π§ Instantiating with Token</h4>
<pre><code class="js">import { GitHubExplorer } from 'github-api-framework';
const explorer = new GitHubExplorer({
token: 'ghp_yourTokenHere'
});</code></pre>
<h4>π Where to generate the token?</h4>
<p>
Go to <a href="https://github.com/settings/tokens" target="_blank">github.com/settings/tokens</a> and click on <strong>"Generate new token (classic)"</strong>.
</p>
<h4>π§ Tips for generation:</h4>
<ul>
<li>π Check only the <code>public_repo</code> scope if you want to access only public repositories</li>
<li>π§Ό NEVER expose the token directly in the frontend in production</li>
<li>π Revoke old tokens that are no longer in use</li>
</ul>
<h4>π¦ Complete example of authenticated usage</h4>
<pre><code class="js">import { GitHubExplorer, GitHubUser } from 'github-api-framework';
const explorer = new GitHubExplorer({
token: 'ghp_XXXXXXXXXXXXXXXXXXXX'
});
const user = new GitHubUser(explorer);
async function carregarPerfil(nome) {
const perfil = await user.getUser(nome);
console.log(perfil);
}</code></pre>
<h4>β οΈ Common errors</h4>
<ul>
<li><code>403: API rate limit</code> β missing or invalid token</li>
<li><code>401: Bad credentials</code> β expired or incorrect token</li>
<li><code>undefined is not a function</code> β forgetting to properly instantiate GitHubExplorer</li>
</ul>
<h4>π Security</h4>
<ul>
<li>βοΈ In client-side apps, use tokens only for testing</li>
<li>π¦ In production, protect the token in the backend and create an intermediary API</li>
<li>π¨βπ» Always use environment variables (<code>.env</code>) for tokens in Node.js, Next.js, or Astro</li>
</ul>
<pre><code class="env"># .env
GITHUB_TOKEN=ghp_XXXXXXXXXXXXXXXXXXXX</code></pre>
</div>
</div>
<div id="conceito-chartjs" class="conteudo-lateral">
<h2>π Integrations with Chart.js</h2>
<div class="oqeh">
<p>
The <strong>GitHub Explorer Framework</strong> is designed to work with visualization libraries like <code>Chart.js</code>, allowing you to easily transform API data into interactive and beautiful charts.
</p>
<h4>π¦ Install Chart.js</h4>
<pre><code class="bash">npm install chart.js</code></pre>
<h4>π Example: Visualizing languages of a repository</h4>
<pre><code class="js">import { GitHubExplorer, GitHubRepo } from 'github-framework';
import Chart from 'chart.js/auto';
const explorer = new GitHubExplorer();
const repo = new GitHubRepo(explorer);
async function mostrarLinguagens() {
const langs = await repo.getRepoLanguages('octocat/Hello-World');
const labels = Object.keys(langs);
const data = Object.values(langs);